:root {
  --brand: #f59e0b;
  --brand-dark: #92400e;
  --ink: #1f2937;
  --muted: #6b7280;
  --line: #fde3bf;
  --paper: #fff7ed;
  --panel: #fffaf3;
  --card: #ffffff;
  --page: #f6f7fb;
  --shadow: 0 18px 45px rgba(92, 54, 10, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  color: var(--ink);
  background: var(--page);
  font-size: 14px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.home-page {
  min-height: 100vh;
  overflow-y: auto;
  background: #f6f7fb;
}

.home-hero {
  min-height: 72vh;
  padding: 18px 28px 48px;
  background: #fff7ed;
  border-bottom: 1px solid #fde3bf;
}

.home-nav {
  width: min(100%, 1120px);
  height: 52px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.home-brand {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #111827;
  font-size: 18px;
  font-weight: 900;
  text-decoration: none;
}

.home-brand img {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
}

.home-nav-actions,
.hero-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-link,
.home-secondary {
  color: #92400e;
  font-weight: 800;
  text-decoration: none;
}

.nav-login {
  height: 38px;
  padding: 0 4px;
  background: transparent;
}

.nav-primary,
.home-primary,
.home-secondary {
  height: 42px;
  padding: 0 18px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.nav-primary,
.home-primary {
  color: #fff;
  background: var(--brand);
  font-weight: 900;
}

.home-primary {
  min-width: 148px;
  background: var(--brand);
}

.home-secondary {
  background: #fff;
  border: 1px solid #fed7aa;
}

.hero-inner {
  width: min(100%, 1120px);
  min-height: calc(72vh - 70px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.04fr) minmax(320px, 0.72fr);
  gap: 42px;
  align-items: center;
}

.hero-copy-main {
  min-width: 0;
}

.hero-kicker,
.section-head span,
.home-cta span {
  display: inline-flex;
  color: #166534;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0;
}

.hero-copy-main h1 {
  max-width: 680px;
  margin: 14px 0 16px;
  color: #111827;
  font-size: 56px;
  line-height: 1.08;
  letter-spacing: 0;
}

.hero-copy-main p {
  max-width: 620px;
  margin: 0 0 28px;
  color: #4b5563;
  font-size: 18px;
  line-height: 1.75;
}

.hero-panel {
  min-height: 360px;
  padding: 28px;
  border-radius: 8px;
  display: grid;
  align-content: center;
  gap: 22px;
  background: #fffaf3;
  color: #111827;
  border: 1px solid #fed7aa;
  box-shadow: 0 20px 48px rgba(120, 53, 15, 0.12);
}

.hero-avatar {
  width: 112px;
  height: 112px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid #ffffff;
  box-shadow: 0 12px 28px rgba(245, 158, 11, 0.2);
}

.hero-dialogue {
  display: grid;
  gap: 10px;
}

.hero-dialogue span {
  color: #f59e0b;
  font-size: 13px;
  font-weight: 900;
}

.hero-dialogue strong {
  font-size: 28px;
  line-height: 1.2;
}

.hero-dialogue p {
  margin: 0;
  color: #6b7280;
  font-size: 15px;
  line-height: 1.7;
}

.home-section {
  width: min(100%, 1120px);
  margin: 0 auto;
  padding: 48px 28px;
}

.section-head {
  margin-bottom: 20px;
}

.section-head h2,
.home-cta h2 {
  margin: 8px 0 0;
  color: #111827;
  font-size: 30px;
  line-height: 1.22;
  letter-spacing: 0;
}

.home-personas {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.home-persona {
  min-height: 188px;
  padding: 16px;
  border-radius: 8px;
  display: grid;
  gap: 12px;
  align-content: start;
  text-align: left;
  color: #111827;
  background: #fff;
  border: 1px solid #e5e7eb;
}

.home-persona:hover {
  border-color: #f59e0b;
  box-shadow: 0 16px 34px rgba(92, 54, 10, 0.1);
}

.home-persona img {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
}

.home-persona span {
  display: grid;
  gap: 4px;
}

.home-persona strong {
  font-size: 17px;
  line-height: 1.2;
}

.home-persona em {
  color: #92400e;
  font-size: 13px;
  font-style: normal;
  font-weight: 800;
}

.home-persona small {
  color: #6b7280;
  font-size: 13px;
  line-height: 1.45;
}

.home-scenarios {
  width: 100%;
  max-width: none;
  padding-left: max(28px, calc((100vw - 1120px) / 2 + 28px));
  padding-right: max(28px, calc((100vw - 1120px) / 2 + 28px));
  background: #ffffff;
  border-top: 1px solid #e5e7eb;
  border-bottom: 1px solid #e5e7eb;
}

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

.scenario-grid article {
  min-height: 142px;
  padding: 18px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  background: #f8fafc;
}

.scenario-grid strong {
  display: block;
  color: #111827;
  font-size: 17px;
}

.scenario-grid p {
  margin: 10px 0 0;
  color: #4b5563;
  line-height: 1.65;
}

.home-cta {
  width: min(calc(100% - 56px), 1120px);
  margin: 48px auto;
  padding: 26px 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
}

.home-cta h2 {
  color: #111827;
}

.app-shell {
  height: 100vh;
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  background: var(--page);
  overflow: hidden;
}

.sidebar {
  height: 100vh;
  min-height: 0;
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  background: #111827;
  color: #fff;
}

.brand-block {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 10px;
  align-items: center;
  padding: 6px 6px 16px;
}

.brand-block strong {
  display: block;
  font-size: 18px;
  line-height: 1.2;
}

.brand-block span {
  display: block;
  margin-top: 4px;
  color: #cbd5e1;
  font-size: 13px;
}

.back-btn,
.mobile-back {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  font-size: 30px;
  line-height: 28px;
}

.persona-list {
  display: grid;
  gap: 8px;
}

.sidebar .persona-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 4px 0;
}

.persona-item {
  width: 100%;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
  min-height: 64px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: inherit;
  text-align: left;
}

.persona-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.persona-item.active {
  border-color: rgba(245, 158, 11, 0.58);
  background: rgba(245, 158, 11, 0.16);
}

.persona-item img {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
}

.persona-item strong {
  display: block;
  margin-bottom: 3px;
  font-size: 13px;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plan span,
.buy-code-btn {
  width: 100%;
  height: 40px;
  margin-bottom: 12px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: var(--brand-dark);
  font-weight: 700;
  text-decoration: none;
}

.buy-code-btn:hover {
  background: #7c2d12;
}

.persona-item > span {
  min-width: 0;
  display: block;
}

.persona-item > span > span {
  display: -webkit-box;
  overflow: hidden;
  color: #cbd5e1;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.redeem-box p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.current-tag {
  color: #fbbf24;
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
  white-space: nowrap;
}

.sidebar-footer {
  display: grid;
  gap: 8px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.side-action {
  height: 40px;
  border-radius: 8px;
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.side-action.primary {
  background: var(--brand);
  font-weight: 700;
}

.workspace {
  min-width: 0;
  min-height: 0;
  height: 100vh;
  display: grid;
  grid-template-rows: 64px minmax(0, 1fr) auto;
  background: var(--paper);
}

.topbar {
  padding: 0 28px;
  background: var(--brand);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.mobile-back {
  display: none;
}

.status-pill {
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  background: rgba(255, 255, 255, 0.2);
  font-size: 13px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #16a34a;
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.18);
}

.top-actions {
  display: none;
  gap: 8px;
}

.ghost-btn,
.primary-mini {
  height: 34px;
  min-width: 58px;
  border-radius: 17px;
  color: #fff;
}

.ghost-btn {
  background: rgba(255, 255, 255, 0.18);
}

.primary-mini {
  background: var(--brand-dark);
}

.chat-panel {
  width: min(100%, 980px);
  min-height: 0;
  margin: 0 auto;
  padding: 24px 28px 22px;
  overflow-y: auto;
}

.agent-card {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.agent-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #fff;
  box-shadow: 0 8px 20px rgba(120, 53, 15, 0.18);
}

.agent-kicker {
  color: var(--muted);
  font-size: 12px;
}

.agent-copy h1 {
  margin: 2px 0;
  font-size: 23px;
  line-height: 1.2;
}

.agent-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.switch-btn {
  display: none;
  height: 38px;
  padding: 0 18px;
  border-radius: 19px;
  color: #fff;
  background: var(--brand);
  font-size: 14px;
}

.profile-summary {
  width: 100%;
  margin: 14px 0;
  padding: 11px 13px;
  border-radius: 8px;
  text-align: left;
  line-height: 1.45;
  font-size: 14px;
  color: #7c2d12;
  background: #fff;
  border: 1px solid var(--line);
}

.quick-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin-bottom: 16px;
}

.quick-btn {
  min-height: 40px;
  padding: 9px 11px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line);
  color: #7c2d12;
  font-size: 14px;
  line-height: 1.45;
  text-align: left;
}

.messages {
  display: grid;
  gap: 12px;
}

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

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

.message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex: 0 0 auto;
}

.bubble {
  max-width: min(76%, 680px);
  padding: 10px 12px;
  border-radius: 8px;
  line-height: 1.6;
  font-size: 14px;
  white-space: pre-wrap;
}

.message.assistant .bubble {
  background: #fff;
  border: 1px solid #ffedd5;
}

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

.composer {
  width: min(100%, 980px);
  margin: 0 auto;
  padding: 10px 28px 18px;
  background: rgba(255, 247, 237, 0.96);
}

.composer-inner {
  display: grid;
  grid-template-columns: 1fr 72px;
  gap: 10px;
  align-items: end;
}

textarea {
  width: 100%;
  min-height: 44px;
  max-height: 150px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  resize: none;
  outline: none;
  background: #fff;
  font-size: 14px;
  line-height: 1.5;
}

.send-btn,
.wide-primary,
.redeem-row button {
  height: 44px;
  border-radius: 8px;
  color: #fff;
  background: var(--brand);
  font-weight: 700;
}

.sheet-mask {
  position: fixed;
  inset: 0 0 0 320px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(17, 24, 39, 0.42);
}

.hidden {
  display: none !important;
}

.sheet {
  width: min(100%, 640px);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  padding: 22px;
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow);
}

.sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.sheet-header h2 {
  margin: 0;
  font-size: 22px;
}

.close-btn {
  height: 34px;
  padding: 0 14px;
  border-radius: 17px;
  background: #f3f4f6;
  color: var(--muted);
}

.form-grid {
  display: grid;
  gap: 12px;
}

.form-grid label {
  display: grid;
  gap: 6px;
}

.form-grid span {
  color: var(--muted);
  font-size: 13px;
}

.form-grid input,
.redeem-row input,
.redeem-phone {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
}

.wide-primary {
  width: 100%;
  margin-top: 16px;
}

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

.plan {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 13px;
  border: 1px solid #f3f4f6;
  border-radius: 8px;
}

.plan.active {
  border-color: var(--brand);
}

.plan strong {
  display: block;
  margin-bottom: 4px;
}

.plan b {
  color: var(--brand);
  font-size: 22px;
  white-space: nowrap;
}

.redeem-box {
  margin-top: 14px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff7ed;
}

.redeem-box p {
  margin: 6px 0 12px;
}

.redeem-phone {
  margin-bottom: 10px;
}

.redeem-row {
  display: grid;
  grid-template-columns: 1fr 74px;
  gap: 8px;
}

.bind-phone-btn {
  width: 100%;
  height: 44px;
  margin-top: 10px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: var(--brand);
  font-weight: 700;
  cursor: pointer;
}

.bind-phone-btn:disabled {
  cursor: not-allowed;
  opacity: 0.72;
}

.account-hint {
  margin-bottom: 0;
}

.account-login-box input {
  width: 100%;
  height: 42px;
  margin-top: 10px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
}

.account-code-row input {
  margin-top: 0;
}

.redeem-page-link {
  display: inline-flex;
  margin-top: 10px;
  color: #92400e;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.redeem-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px 14px;
  background: var(--paper);
}

.redeem-card {
  width: min(100%, 520px);
  padding: 24px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: var(--shadow);
}

.redeem-card h1 {
  margin: 10px 0 8px;
  color: #431407;
  font-size: 32px;
  line-height: 1.14;
}

.redeem-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.redeem-kicker {
  display: inline-flex;
  padding: 6px 12px;
  border-radius: 999px;
  color: #92400e;
  background: #ffedd5;
  font-size: 13px;
  font-weight: 800;
}

.redeem-form {
  display: grid;
  gap: 12px;
  margin-top: 22px;
}

.redeem-form label {
  display: grid;
  gap: 6px;
  color: #92400e;
  font-weight: 800;
}

.redeem-form input {
  width: 100%;
  height: 46px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
}

.redeem-submit {
  height: 46px;
  border-radius: 8px;
  color: #fff;
  background: var(--brand);
  font-weight: 900;
}

.redeem-submit:disabled {
  background: #fbbf24;
}

.membership-box,
.redeem-result {
  margin-top: 14px;
  padding: 13px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff7ed;
  color: #7c2d12;
  line-height: 1.55;
}

.redeem-result.success {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}

.redeem-result.error {
  border-color: #fecaca;
  background: #fff1f2;
  color: #991b1b;
}

.redeem-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.redeem-actions a {
  flex: 1;
  height: 42px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: var(--brand-dark);
  font-weight: 800;
  text-decoration: none;
}

@media (max-width: 820px) {
  .home-hero {
    min-height: auto;
    padding: env(safe-area-inset-top) 16px 34px;
  }

  .home-nav {
    height: 58px;
  }

  .home-brand span {
    font-size: 17px;
  }

  .home-nav-actions {
    gap: 8px;
  }

  .nav-link {
    display: none;
  }

  .nav-primary {
    height: 38px;
    padding: 0 14px;
  }

  .hero-inner {
    min-height: auto;
    grid-template-columns: 1fr;
    gap: 24px;
    padding-top: 26px;
  }

  .hero-copy-main h1 {
    margin-top: 12px;
    font-size: 38px;
    line-height: 1.12;
  }

  .hero-copy-main p {
    margin-bottom: 22px;
    font-size: 16px;
    line-height: 1.68;
  }

  .hero-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .home-primary,
  .home-secondary {
    width: 100%;
  }

  .hero-panel {
    min-height: 250px;
    padding: 22px;
  }

  .hero-avatar {
    width: 86px;
    height: 86px;
  }

  .hero-dialogue strong {
    font-size: 23px;
  }

  .home-section {
    padding: 34px 16px;
  }

  .section-head h2,
  .home-cta h2 {
    font-size: 24px;
  }

  .home-personas,
  .scenario-grid {
    grid-template-columns: 1fr;
  }

  .home-persona {
    min-height: 0;
    grid-template-columns: 52px minmax(0, 1fr);
    align-items: center;
  }

  .home-persona small {
    grid-column: 1 / -1;
  }

  .home-scenarios {
    padding-left: 16px;
    padding-right: 16px;
  }

  .home-cta {
    width: calc(100% - 32px);
    margin: 34px auto;
    padding: 22px;
    align-items: stretch;
    flex-direction: column;
  }

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

  .sidebar {
    display: none;
  }

  .workspace {
    width: 100%;
    height: 100vh;
    grid-template-rows: calc(56px + env(safe-area-inset-top)) minmax(0, 1fr) auto;
  }

  .topbar {
    padding: env(safe-area-inset-top) 14px 0;
  }

  .mobile-back {
    display: inline-grid;
    place-items: center;
  }

  .top-actions {
    display: flex;
  }

  .sheet-mask {
    inset: 0;
    align-items: flex-end;
    padding: 0;
  }

  .sheet {
    width: min(100%, 520px);
    max-height: 86vh;
    padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
    border-radius: 20px 20px 0 0;
  }

  .sheet-header h2 {
    font-size: 20px;
  }

  .chat-panel {
    width: 100%;
    padding: 14px 14px 16px;
  }

  .agent-card {
    grid-template-columns: 62px 1fr 64px;
    padding: 14px;
  }

  .agent-avatar {
    width: 62px;
    height: 62px;
  }

  .agent-copy h1 {
    font-size: 22px;
  }

  .switch-btn {
    display: inline-block;
  }

  .quick-panel {
    grid-template-columns: 1fr;
  }

  .bubble {
    max-width: 84%;
  }

  .composer {
    width: 100%;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
  }

  .composer-inner {
    grid-template-columns: 1fr 66px;
    gap: 8px;
  }
}

@media (min-width: 821px) and (max-width: 1040px) {
  .hero-inner {
    grid-template-columns: minmax(0, 1fr) minmax(300px, 0.74fr);
    gap: 28px;
  }

  .hero-copy-main h1 {
    font-size: 46px;
  }

  .home-personas {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .app-shell {
    grid-template-columns: 300px minmax(0, 1fr);
  }

  .sidebar {
    padding: 16px 12px;
  }

  .persona-item {
    grid-template-columns: 38px minmax(0, 1fr) auto;
    gap: 8px;
    padding: 8px;
  }

  .persona-item img {
    width: 38px;
    height: 38px;
  }

  .persona-item strong {
    font-size: 12px;
  }

  .persona-item > span > span {
    font-size: 11px;
    line-height: 1.3;
  }
}
