:root {
  --ink: #15211d;
  --muted: #66736e;
  --line: #dfe8e3;
  --paper: #ffffff;
  --canvas: #f3f6f1;
  --green: #126e59;
  --green-dark: #0b4f40;
  --green-pale: #e5f3ec;
  --amber: #b96b20;
  --amber-pale: #fff2df;
  --red: #b5473d;
  --red-pale: #fbebe8;
  --shadow: 0 18px 55px rgba(23, 52, 42, 0.08);
  --radius: 24px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
  color: var(--ink);
  background: var(--canvas);
  font-family: "Microsoft YaHei UI", "PingFang SC", "Noto Sans SC", sans-serif;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 8% 4%, rgba(181, 221, 195, 0.52), transparent 25rem),
    radial-gradient(circle at 92% 90%, rgba(239, 206, 157, 0.24), transparent 28rem),
    var(--canvas);
}

button,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.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-header {
  width: min(1320px, calc(100% - 48px));
  height: 88px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: #fff;
  background: var(--green-dark);
  font-family: "STSong", "Songti SC", serif;
  font-size: 23px;
  box-shadow: 0 8px 20px rgba(11, 79, 64, 0.2);
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 17px;
  letter-spacing: 0.04em;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
}

.header-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--muted);
  font-size: 12px;
}

.settings-button {
  height: 36px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid #d3dfd9;
  border-radius: 11px;
  color: #40534c;
  background: rgba(255, 255, 255, 0.75);
  font-size: 11px;
  font-weight: 700;
  transition: 150ms ease;
}

.settings-button:hover {
  border-color: var(--green);
  color: var(--green);
  background: #fff;
}

.settings-button svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.mode-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  border: 1px solid rgba(18, 110, 89, 0.14);
  border-radius: 999px;
  color: var(--green);
  background: rgba(255, 255, 255, 0.58);
}

.mode-badge i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #36b489;
  box-shadow: 0 0 0 4px rgba(54, 180, 137, 0.12);
}

.app-shell {
  width: min(1320px, calc(100% - 48px));
  min-height: calc(100vh - 128px);
  margin: 0 auto 40px;
  display: grid;
  grid-template-columns: minmax(0, 1.62fr) minmax(340px, 0.9fr);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.92);
  border-radius: 32px;
  background: rgba(255, 255, 255, 0.74);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.chat-panel {
  min-height: 760px;
  display: flex;
  flex-direction: column;
  position: relative;
  padding: 44px 48px 26px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.82), rgba(255, 255, 255, 0.94)),
    repeating-linear-gradient(135deg, transparent 0 19px, rgba(18, 110, 89, 0.035) 20px 21px);
}

.chat-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 32px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.chat-heading h1,
.profile-header h2,
.dialog-header h2 {
  margin: 0;
  font-family: "STSong", "Songti SC", "SimSun", serif;
  font-weight: 700;
}

.chat-heading h1 {
  font-size: clamp(30px, 3vw, 48px);
  letter-spacing: -0.02em;
}

.chat-heading > div > p:last-child {
  max-width: 570px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.8;
}

.agent-avatar {
  width: 68px;
  height: 68px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  position: relative;
  border-radius: 22px 22px 22px 6px;
  color: #fff;
  background: linear-gradient(145deg, #1b7d66, #0b4f40);
  font-family: "STSong", "Songti SC", serif;
  font-size: 27px;
  box-shadow: 0 14px 30px rgba(11, 79, 64, 0.2);
}

.agent-avatar i {
  position: absolute;
  right: -5px;
  bottom: -5px;
  width: 18px;
  height: 18px;
  border: 4px solid #fff;
  border-radius: 50%;
  background: #49bd8f;
}

.chat-log {
  flex: 1;
  min-height: 310px;
  max-height: 480px;
  margin: 36px -12px 12px;
  padding: 0 12px;
  overflow-y: auto;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: #cddbd4 transparent;
}

.message {
  width: min(82%, 650px);
  margin-bottom: 18px;
  animation: message-in 280ms ease both;
}

.message.is-agent {
  margin-right: auto;
}

.message.is-user {
  margin-left: auto;
}

.message-meta {
  margin: 0 0 7px 12px;
  color: #83908b;
  font-size: 11px;
}

.message.is-user .message-meta {
  margin-right: 12px;
  text-align: right;
}

.message-bubble {
  padding: 15px 18px;
  border: 1px solid var(--line);
  border-radius: 5px 18px 18px 18px;
  color: #24332e;
  background: #fff;
  font-size: 14px;
  line-height: 1.75;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  box-shadow: 0 8px 24px rgba(30, 64, 51, 0.045);
}

.message.is-user .message-bubble {
  border-color: var(--green-dark);
  border-radius: 18px 5px 18px 18px;
  color: #fff;
  background: var(--green-dark);
  box-shadow: 0 10px 28px rgba(11, 79, 64, 0.15);
}

.typing {
  display: flex;
  gap: 5px;
  align-items: center;
  min-width: 58px;
}

.typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #93aaa0;
  animation: typing 1.1s infinite ease-in-out;
}

.typing span:nth-child(2) {
  animation-delay: 120ms;
}

.typing span:nth-child(3) {
  animation-delay: 240ms;
}

.quick-replies {
  min-height: 42px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 0 10px;
}

.quick-reply {
  padding: 8px 13px;
  border: 1px solid #cadbd2;
  border-radius: 999px;
  color: var(--green-dark);
  background: rgba(255, 255, 255, 0.8);
  font-size: 12px;
  transition: 150ms ease;
}

.quick-reply:hover {
  border-color: var(--green);
  background: var(--green-pale);
  transform: translateY(-1px);
}

.composer {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 8px;
  border: 1px solid #cad8d2;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(22, 64, 50, 0.07);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.composer:focus-within {
  border-color: rgba(18, 110, 89, 0.65);
  box-shadow: 0 13px 34px rgba(18, 110, 89, 0.11);
}

.composer textarea {
  flex: 1;
  min-height: 44px;
  max-height: 130px;
  padding: 11px 10px;
  resize: none;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 14px;
  line-height: 1.5;
}

.composer textarea::placeholder {
  color: #98a49f;
}

.send-button {
  height: 44px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  border-radius: 14px;
  color: #fff;
  background: var(--green);
  font-size: 13px;
  font-weight: 700;
}

.send-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.send-button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.composer-note {
  margin: 10px 4px 0;
  color: #8b9792;
  text-align: center;
  font-size: 10px;
}

.profile-panel {
  padding: 42px 36px 30px;
  border-left: 1px solid var(--line);
  background: rgba(249, 251, 248, 0.86);
}

.profile-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.profile-header h2 {
  font-size: 25px;
}

.status-badge {
  padding: 7px 10px;
  border-radius: 999px;
  color: var(--amber);
  background: var(--amber-pale);
  font-size: 10px;
  font-weight: 700;
}

.status-badge.is-ready {
  color: var(--green);
  background: var(--green-pale);
}

.workspace-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-top: 20px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #eef3ef;
}

.workspace-tab {
  min-height: 34px;
  border: 0;
  border-radius: 9px;
  color: #78857f;
  background: transparent;
  font-size: 10px;
  font-weight: 700;
}

.workspace-tab.is-active {
  color: var(--green-dark);
  background: #fff;
  box-shadow: 0 3px 10px rgba(20, 53, 41, 0.08);
}

.workspace-view {
  display: none;
}

.workspace-view.is-active {
  display: block;
}

.browser-toolbar {
  margin-top: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.browser-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #66756e;
  font-size: 10px;
}

.browser-status i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #aab4af;
}

.browser-status i.is-online {
  background: #3bb383;
  box-shadow: 0 0 0 4px rgba(59, 179, 131, 0.12);
}

.browser-stage {
  position: relative;
  height: 440px;
  margin-top: 14px;
  overflow: hidden;
  border: 1px solid #cfdcd5;
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(18, 110, 89, 0.04), rgba(225, 208, 175, 0.11)),
    #fff;
}

.browser-stage.is-clickable img {
  cursor: crosshair;
}

.browser-stage img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  background: #eef2ef;
}

.browser-placeholder {
  height: 100%;
  padding: 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.browser-placeholder-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 1px solid #d5e2db;
  border-radius: 15px;
  color: var(--green);
  background: #fff;
  font-size: 22px;
}

.browser-placeholder strong {
  margin-top: 14px;
  font-family: "STSong", "Songti SC", serif;
  font-size: 18px;
}

.browser-placeholder p {
  max-width: 240px;
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.7;
}

.browser-controls {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.browser-controls .button {
  flex: 1;
  min-height: 36px;
}

.browser-controls .is-active {
  border-color: var(--green);
  color: var(--green);
  background: var(--green-pale);
}

.browser-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 7px;
  margin-top: 9px;
}

.browser-input-row input {
  min-width: 0;
  height: 36px;
  padding: 0 10px;
  border: 1px solid #d3ded8;
  border-radius: 10px;
  outline: none;
  background: #fff;
  font: inherit;
  font-size: 10px;
}

.browser-input-row input:focus {
  border-color: var(--green);
}

.browser-input-row .button {
  min-height: 36px;
  padding: 0 10px;
}

.browser-hint {
  margin: 10px 2px 0;
  color: #89958f;
  font-size: 9px;
  line-height: 1.6;
}

.progress-card {
  margin-top: 24px;
  padding: 18px;
  border-radius: 18px;
  color: #fff;
  background:
    radial-gradient(circle at 90% 0, rgba(255, 255, 255, 0.14), transparent 9rem),
    var(--green-dark);
}

.progress-copy {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.progress-copy span {
  font-family: Georgia, serif;
  font-size: 33px;
  font-weight: 700;
}

.progress-copy p {
  margin: 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 11px;
}

.progress-track {
  height: 5px;
  margin: 13px 0 12px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.18);
}

.progress-track span {
  width: 0;
  height: 100%;
  display: block;
  border-radius: inherit;
  background: #e8c68d;
  transition: width 450ms ease;
}

.progress-detail {
  margin: 0;
  color: rgba(255, 255, 255, 0.68);
  font-size: 10px;
  line-height: 1.55;
}

.profile-sections {
  margin-top: 26px;
}

.profile-section {
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
}

.profile-section:first-child {
  padding-top: 0;
}

.profile-section h3 {
  margin: 0 0 10px;
  color: #84908b;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.11em;
}

.profile-row {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 10px;
  margin-top: 7px;
  font-size: 12px;
  line-height: 1.55;
}

.profile-row dt {
  color: #7a8681;
}

.profile-row dd {
  margin: 0;
  color: #283831;
  overflow-wrap: anywhere;
}

.profile-row dd.is-empty {
  color: #a7b0ac;
}

.risk-card {
  margin-top: 18px;
  padding: 14px;
  border: 1px solid #f0d8b6;
  border-radius: 16px;
  background: #fffaf1;
}

.risk-card.is-empty {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.52);
}

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

.risk-icon {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--amber);
  background: var(--amber-pale);
  font-family: Georgia, serif;
  font-weight: 700;
}

.risk-heading strong {
  color: #6f4e23;
  font-size: 12px;
}

.risk-heading p {
  margin: 3px 0 0;
  color: #957a57;
  font-size: 10px;
  line-height: 1.5;
}

.risk-card ul {
  margin: 10px 0 0 32px;
  padding: 0;
  color: #7c5d35;
  font-size: 10px;
  line-height: 1.6;
}

.profile-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.button {
  min-height: 42px;
  padding: 0 15px;
  border-radius: 13px;
  font-size: 12px;
  font-weight: 700;
}

.button-primary {
  border: 1px solid var(--green-dark);
  color: #fff;
  background: var(--green-dark);
}

.button-primary:hover {
  background: var(--green);
}

.button-quiet {
  border: 1px solid #d4dfda;
  color: #52615b;
  background: #fff;
}

.profile-actions .button-primary {
  flex: 1;
}

.summary-dialog {
  width: min(760px, calc(100vw - 32px));
  max-height: min(84vh, 860px);
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 24px;
  color: var(--ink);
  background: #fff;
  box-shadow: 0 30px 90px rgba(12, 42, 32, 0.24);
}

.summary-dialog::backdrop {
  background: rgba(13, 35, 27, 0.46);
  backdrop-filter: blur(4px);
}

.dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 26px 28px 20px;
  border-bottom: 1px solid var(--line);
}

.dialog-header h2 {
  font-size: 27px;
}

.icon-button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: #63716b;
  background: #f7f9f7;
  font-size: 22px;
  line-height: 1;
}

.summary-dialog pre {
  max-height: calc(84vh - 180px);
  margin: 0;
  padding: 24px 28px;
  overflow: auto;
  color: #31413a;
  font-family: "Microsoft YaHei UI", "PingFang SC", sans-serif;
  font-size: 12px;
  line-height: 1.85;
  white-space: pre-wrap;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 28px 22px;
  border-top: 1px solid var(--line);
}

.proposal-dialog {
  width: min(620px, calc(100vw - 32px));
  max-width: none;
  padding: 0;
  border: 0;
  border-radius: 24px;
  color: var(--ink);
  background: transparent;
  box-shadow: 0 30px 90px rgba(12, 42, 32, 0.24);
}

.proposal-dialog::backdrop {
  background: rgba(13, 35, 27, 0.46);
  backdrop-filter: blur(4px);
}

.proposal-dialog-card {
  position: relative;
  padding: 28px;
  border-radius: 24px;
  background: #fff;
}

.proposal-close {
  position: absolute;
  top: 18px;
  right: 18px;
}

.proposal-dialog h2 {
  margin: 4px 0 8px;
  font-family: "STSong", "Songti SC", serif;
  font-size: 26px;
}

.proposal-dialog p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.proposal-name-box {
  margin: 20px 0;
  padding: 15px 16px;
  border: 1px solid #d7e5dd;
  border-radius: 14px;
  background: #f4faf6;
}

.proposal-name-box span,
.proposal-name-box code {
  display: block;
}

.proposal-name-box span {
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 11px;
}

.proposal-name-box code {
  color: var(--green-dark);
  font-family: "Microsoft YaHei UI", "PingFang SC", sans-serif;
  font-size: 13px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

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

.proposal-edit-panel {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.proposal-edit-panel textarea {
  width: 100%;
  min-height: 92px;
  margin-top: 8px;
  padding: 12px 14px;
  resize: vertical;
  border: 1px solid #cad8d2;
  border-radius: 12px;
  color: var(--ink);
  background: #fbfdfb;
  line-height: 1.55;
}

.proposal-help {
  margin-top: 8px !important;
  font-size: 11px;
}

.button-danger {
  border: 1px solid #d8a6a0;
  color: var(--red);
  background: #fff;
}

.button-danger:hover {
  background: var(--red-pale);
}

.studio-dialog {
  width: min(1240px, calc(100vw - 36px));
  height: min(880px, calc(100vh - 36px));
  max-width: none;
  max-height: none;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 26px;
  color: var(--ink);
  background: #fff;
  box-shadow: 0 32px 100px rgba(11, 41, 31, 0.3);
}

.studio-dialog::backdrop {
  background: rgba(12, 32, 25, 0.55);
  backdrop-filter: blur(5px);
}

.studio-shell {
  height: 100%;
  display: grid;
  grid-template-columns: 216px minmax(0, 1fr);
}

.studio-nav {
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  color: #fff;
  background:
    radial-gradient(circle at 10% 5%, rgba(107, 187, 154, 0.2), transparent 12rem),
    #103f34;
}

.studio-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px;
}

.studio-brand .brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  color: var(--green-dark);
  background: #f2e3c6;
  box-shadow: none;
  font-size: 19px;
}

.studio-brand strong,
.studio-brand small {
  display: block;
}

.studio-brand strong {
  font-size: 13px;
  letter-spacing: 0.04em;
}

.studio-brand small {
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.55);
  font-size: 10px;
}

.studio-nav nav {
  display: grid;
  gap: 7px;
  margin-top: 36px;
}

.studio-tab {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid transparent;
  border-radius: 11px;
  color: rgba(255, 255, 255, 0.68);
  background: transparent;
  text-align: left;
  font-size: 12px;
  transition: 140ms ease;
}

.studio-tab:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.studio-tab.is-active {
  border-color: rgba(255, 255, 255, 0.12);
  color: #173f33;
  background: #eef5ef;
  font-weight: 700;
}

.studio-nav-note {
  margin-top: auto;
  padding: 13px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
}

.studio-nav-note span,
.studio-nav-note strong {
  display: block;
}

.studio-nav-note span {
  color: rgba(255, 255, 255, 0.45);
  font-size: 9px;
  letter-spacing: 0.12em;
}

.studio-nav-note strong {
  margin-top: 5px;
  color: #d8ece3;
  font-size: 10px;
  font-weight: 600;
}

.studio-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: #f8faf7;
}

.studio-header {
  min-height: 82px;
  padding: 18px 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
}

.studio-header h2 {
  margin: 0;
  font-family: "STSong", "Songti SC", serif;
  font-size: 24px;
}

.studio-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.studio-content {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.studio-panel {
  display: none;
  min-height: 100%;
  padding: 26px;
}

.studio-panel.is-active {
  display: block;
}

.intro-banner {
  display: flex;
  align-items: center;
  gap: 17px;
  padding: 22px;
  border-radius: 19px;
  color: #fff;
  background:
    radial-gradient(circle at 90% 0, rgba(255, 255, 255, 0.12), transparent 13rem),
    var(--green-dark);
}

.intro-avatar {
  width: 62px;
  height: 62px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 19px;
  color: var(--green-dark);
  background: #f1ddb9;
  font-family: "STSong", "Songti SC", serif;
  font-size: 27px;
}

.mini-label {
  color: var(--green);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.intro-banner .mini-label {
  color: #a9d7c4;
}

.intro-banner h3 {
  margin: 5px 0;
  font-family: "STSong", "Songti SC", serif;
  font-size: 26px;
}

.intro-banner p {
  margin: 0;
  color: rgba(255, 255, 255, 0.67);
  font-size: 11px;
  line-height: 1.6;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 14px;
}

.metric-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #fff;
}

.metric-card span {
  font-family: Georgia, serif;
  font-size: 27px;
  font-weight: 700;
}

.metric-card p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.studio-card {
  margin-top: 14px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: #fff;
}

.studio-card h3,
.panel-heading h3,
.editor-meta h3 {
  margin: 0;
  font-size: 14px;
}

.field-label {
  display: grid;
  gap: 7px;
  margin-top: 14px;
  color: #5d6b65;
  font-size: 10px;
  font-weight: 700;
}

.field-label input,
.field-label textarea,
.knowledge-search-wrap input,
.knowledge-editor textarea,
.instructions-editor,
.token-row input {
  width: 100%;
  border: 1px solid #d7e1dc;
  border-radius: 11px;
  outline: none;
  color: var(--ink);
  background: #fbfcfa;
  font: inherit;
  font-size: 12px;
}

.field-label input {
  height: 42px;
  padding: 0 12px;
}

.field-label textarea {
  padding: 11px 12px;
  resize: vertical;
  line-height: 1.6;
}

.field-label input:focus,
.field-label textarea:focus,
.knowledge-search-wrap input:focus,
.knowledge-editor textarea:focus,
.instructions-editor:focus,
.token-row input:focus {
  border-color: var(--green);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(18, 110, 89, 0.08);
}

.capability-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 9px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.capability-list li {
  padding: 12px;
  border-radius: 11px;
  color: #3e5049;
  background: #f5f8f5;
  font-size: 11px;
}

.capability-list li span {
  margin-right: 7px;
  color: #a1ada7;
  font-family: Georgia, serif;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.panel-heading h3 {
  margin-top: 5px;
  font-family: "STSong", "Songti SC", serif;
  font-size: 22px;
}

.panel-heading p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.count-pill,
.dirty-pill {
  padding: 6px 9px;
  border-radius: 99px;
  color: var(--green);
  background: var(--green-pale);
  font-size: 9px;
  font-weight: 700;
}

.dirty-pill {
  color: var(--amber);
  background: var(--amber-pale);
}

.database-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #fff;
}

.database-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.database-table th,
.database-table td {
  padding: 12px 15px;
  border-bottom: 1px solid #edf1ee;
  text-align: left;
}

.database-table th {
  position: sticky;
  top: 0;
  color: #7a8982;
  background: #f6f8f6;
  font-size: 9px;
  letter-spacing: 0.06em;
}

.database-table tr:last-child td {
  border-bottom: 0;
}

.studio-tip {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  color: #726244;
  background: #fff9ed;
  font-size: 10px;
  line-height: 1.65;
}

.knowledge-layout {
  height: 100%;
  min-height: 610px;
  display: grid;
  grid-template-columns: 255px minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: #fff;
}

.knowledge-sidebar {
  min-width: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: #f7f9f7;
}

.knowledge-search-wrap {
  padding: 13px;
  border-bottom: 1px solid var(--line);
}

.knowledge-search-wrap input {
  height: 36px;
  padding: 0 10px;
}

.knowledge-search-wrap span {
  display: block;
  margin-top: 8px;
  color: #8b9892;
  font-size: 9px;
}

.knowledge-list {
  min-height: 0;
  flex: 1;
  overflow: auto;
  padding: 8px;
}

.knowledge-category {
  margin: 12px 6px 5px;
  color: #7d8b85;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.knowledge-category:first-child {
  margin-top: 2px;
}

.knowledge-item {
  width: 100%;
  margin-bottom: 5px;
  padding: 10px 11px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: #44534d;
  background: transparent;
  text-align: left;
}

.knowledge-item:hover {
  background: #edf3ef;
}

.knowledge-item.is-active {
  border-color: #ccddd4;
  background: #e5f1eb;
}

.knowledge-item span,
.knowledge-item strong {
  display: block;
}

.knowledge-item span {
  color: #8b9892;
  font-family: Georgia, serif;
  font-size: 9px;
}

.knowledge-item strong {
  margin-top: 4px;
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.knowledge-editor {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.editor-meta {
  padding: 14px 17px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.editor-meta h3 {
  margin-top: 4px;
}

.knowledge-editor textarea {
  min-height: 0;
  flex: 1;
  resize: none;
  padding: 18px;
  border: 0;
  border-radius: 0;
  font-family: "Cascadia Code", "Consolas", monospace;
  font-size: 11px;
  line-height: 1.7;
}

.editor-footer {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  border-top: 1px solid var(--line);
}

.editor-footer > span {
  color: #87938e;
  font-size: 9px;
}

.instructions-editor {
  width: 100%;
  height: 590px;
  padding: 18px;
  resize: vertical;
  font-family: "Cascadia Code", "Consolas", monospace;
  font-size: 11px;
  line-height: 1.7;
}

.admin-lock {
  margin: 26px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: #fff;
}

.admin-lock strong {
  font-family: "STSong", "Songti SC", serif;
  font-size: 20px;
}

.admin-lock p {
  color: var(--muted);
  font-size: 11px;
}

.token-row {
  display: flex;
  gap: 8px;
}

.token-row input {
  height: 42px;
  padding: 0 12px;
}

.token-row .button {
  flex: 0 0 auto;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 20;
  padding: 10px 16px;
  border-radius: 999px;
  color: #fff;
  background: rgba(16, 43, 34, 0.92);
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 10px);
  transition: 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@keyframes message-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

@keyframes typing {
  0%,
  70%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }
  35% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

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

  .chat-panel {
    min-height: 720px;
  }

  .profile-panel {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .chat-log {
    max-height: 440px;
  }
}

@media (max-width: 640px) {
  .app-header,
  .app-shell {
    width: 100%;
  }

  .app-header {
    height: 76px;
    padding: 0 18px;
  }

  .header-meta .privacy-note {
    display: none;
  }

  .mode-badge {
    padding: 7px 9px;
    font-size: 10px;
  }

  .app-shell {
    min-height: calc(100vh - 76px);
    margin: 0;
    border-radius: 24px 24px 0 0;
  }

  .chat-panel {
    min-height: calc(100vh - 76px);
    padding: 30px 18px 20px;
  }

  .chat-heading h1 {
    font-size: 34px;
  }

  .chat-heading > div > p:last-child {
    font-size: 12px;
  }

  .agent-avatar {
    width: 54px;
    height: 54px;
    border-radius: 17px 17px 17px 5px;
    font-size: 22px;
  }

  .chat-log {
    margin-top: 24px;
  }

  .message {
    width: 92%;
  }

  .message-bubble {
    padding: 13px 15px;
    font-size: 13px;
  }

  .composer {
    border-radius: 17px;
  }

  .send-button span {
    display: none;
  }

  .send-button {
    width: 44px;
    padding: 0;
    justify-content: center;
  }

  .profile-panel {
    padding: 30px 20px 28px;
  }

  .settings-button span {
    display: none;
  }

  .settings-button {
    width: 38px;
    padding: 0;
    justify-content: center;
  }

  .studio-dialog {
    width: 100vw;
    height: 100vh;
    border-radius: 0;
  }

  .studio-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .studio-nav {
    padding: 12px 14px 10px;
  }

  .studio-brand {
    display: none;
  }

  .studio-nav nav {
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
    margin: 0;
  }

  .studio-tab {
    padding: 9px 4px;
    text-align: center;
    font-size: 10px;
  }

  .studio-nav-note {
    display: none;
  }

  .studio-header {
    min-height: 72px;
    padding: 13px 16px;
  }

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

  .studio-header-actions .button-primary {
    padding: 0 10px;
    font-size: 10px;
  }

  .studio-panel {
    padding: 16px;
  }

  .metric-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .capability-list {
    grid-template-columns: 1fr;
  }

  .knowledge-layout {
    min-height: 650px;
    grid-template-columns: 1fr;
    grid-template-rows: 180px minmax(0, 1fr);
  }

  .knowledge-sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .knowledge-list {
    display: flex;
    gap: 5px;
    overflow-x: auto;
  }

  .knowledge-item {
    min-width: 150px;
    margin: 0;
  }

  .editor-footer > span {
    display: none;
  }

  .instructions-editor {
    height: 620px;
  }
}

@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;
  }
}
