:root {
  color-scheme: light;
  --cream:#F7F1E8;
  --cream2:#FFF6EA;
  --ivory:#FFFDF8;
  --white:#FFFAF3;
  --coffee:#3C2F28;
  --brown:#6C4A35;
  --muted:#9A7D67;
  --line:#EAD8BE;
  --line-strong:#D8BE95;
  --gold:#B88646;
  --gold2:#D7A95F;
  --gold3:#F7DEB0;
  --terracotta:#C9644B;
  --red:#B34B32;
  --green:#6F7F58;
  --bg: var(--cream);
  --panel: var(--ivory);
  --panel-soft: var(--cream2);
  --ink: var(--coffee);
  --brand: var(--gold);
  --brand-2: var(--terracotta);
  --rose: var(--red);
  --shadow:0 18px 48px rgba(88,55,26,.14);
  --shadow2:0 10px 26px rgba(88,55,26,.10);
  --radius: 22px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html, body, #app { min-height: 100%; }
html, body { overflow-x: hidden; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 0%, rgba(255,255,255,.95), transparent 25rem),
    radial-gradient(circle at 88% 8%, rgba(247,222,176,.88), transparent 28rem),
    linear-gradient(180deg,#fffaf2 0%,#f7f1e8 48%,#ead8be 100%);
}
body:before{
  content:"";
  position:fixed;
  inset:0;
  pointer-events:none;
  opacity:.42;
  background-image:linear-gradient(90deg,rgba(184,134,70,.035) 1px,transparent 1px),linear-gradient(rgba(184,134,70,.035) 1px,transparent 1px);
  background-size:24px 24px;
  mask-image:linear-gradient(#000,transparent 78%);
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }

.page { min-height: 100vh; }
.login {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(360px, 0.9fr) minmax(520px, 1.1fr);
  gap: 46px;
  align-items: center;
  padding: clamp(28px, 6vw, 96px);
}
.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  color: white;
  background: linear-gradient(145deg,var(--gold3),var(--gold));
  box-shadow: 0 10px 24px rgba(184,134,70,.28), inset 0 0 0 1px rgba(255,255,255,.38);
}
.hero h1 {
  margin: 22px 0 14px;
  font-family:"Songti SC","STSong","Noto Serif CJK SC",serif;
  font-size: clamp(40px, 5vw, 68px);
  line-height: 1.08;
  letter-spacing: -0.04em;
}
.hero p {
  margin: 0;
  max-width: 680px;
  color: var(--muted);
  font-size: clamp(17px, 1.7vw, 23px);
  line-height: 1.72;
  font-weight: 580;
}
.login-card, .panel, .agent-card, .chat-panel, .sidebar {
  border: 1px solid rgba(184,134,70,.20);
  border-radius: var(--radius);
  background: linear-gradient(180deg,rgba(255,253,248,.97),rgba(255,249,242,.96));
  box-shadow: var(--shadow2);
}
.login-card { padding: 28px; display: grid; gap: 18px; position: relative; overflow: hidden; }
.login-card:before,.panel:before,.agent-card:before{
  content:"";
  position:absolute;
  inset:0;
  background:radial-gradient(circle at 0 0,rgba(247,222,176,.34),transparent 10rem);
  pointer-events:none;
}
.login-card > *,.panel > *,.agent-card > *{ position: relative; }
.login-card h2 { margin: 0; font-size: 24px; letter-spacing: 0; }
.field { display: grid; gap: 7px; }
.field label { color: #3c4650; font-size: 13px; font-weight: 760; }
.input, .textarea, .select {
  width: 100%;
  min-height: 44px;
  border: 1px solid rgba(184,134,70,.28);
  border-radius: 16px;
  background: rgba(255,255,255,.72);
  color: var(--ink);
  padding: 11px 12px;
  outline: none;
}
.textarea { min-height: 126px; resize: vertical; line-height: 1.65; }
.input:focus, .textarea:focus, .select:focus {
  border-color: rgba(201,100,75,.55);
  box-shadow: 0 0 0 4px rgba(201,100,75,.08), inset 0 2px 8px rgba(91,58,27,.04);
}
.btn {
  min-height: 40px;
  border: 1px solid rgba(184,134,70,.28);
  border-radius: 16px;
  background: rgba(255,255,255,.68);
  color: var(--brown);
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 730;
}
.btn:hover { border-color: rgba(184,134,70,.48); background: #fff6e7; }
.btn.primary {
  border-color: transparent;
  background: linear-gradient(180deg,#edc474 0%,#c38b3b 53%,#9f6128 100%);
  color: white;
  box-shadow:0 13px 24px rgba(184,134,70,.28), inset 0 2px 0 rgba(255,255,255,.42);
  text-shadow:0 1px 0 rgba(70,38,0,.22);
}
.btn.secondary { border-color: rgba(201,100,75,.22); background: #fff4e8; color: #8d402d; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.danger { border-color: rgba(189,61,84,0.26); background: #fff3f5; color: var(--rose); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.quick-codes { display: flex; flex-wrap: wrap; gap: 8px; }
.entry-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.entry-card {
  min-height: 132px;
  border: 1px solid rgba(184,134,70,.22);
  border-radius: 22px;
  background: linear-gradient(180deg,rgba(255,253,248,.86),rgba(255,246,234,.84));
  color: var(--coffee);
  padding: 16px;
  display: grid;
  justify-items: start;
  align-content: start;
  gap: 8px;
  text-align: left;
  box-shadow: 0 10px 24px rgba(88,55,26,.08);
}
.entry-card:hover {
  border-color: rgba(201,100,75,.38);
  transform: translateY(-1px);
  box-shadow: 0 16px 30px rgba(88,55,26,.12);
}
.entry-icon {
  width: 38px;
  height: 38px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: white;
  background: linear-gradient(145deg,var(--gold3),var(--gold));
  box-shadow: 0 10px 20px rgba(184,134,70,.22);
}
.entry-card strong {
  font-size: 18px;
  letter-spacing: 0;
}
.entry-card small {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}
.admin-entry .entry-icon {
  background: linear-gradient(180deg,#df7652,#b6422c);
  box-shadow: 0 10px 20px rgba(201,100,75,.22);
}
.hint { color: var(--muted); font-size: 13px; line-height: 1.6; }
.notice, .error, .success {
  border-radius: var(--radius);
  padding: 11px 12px;
  line-height: 1.55;
}
.notice { border: 1px solid rgba(184,134,70,.18); background: #fff5e8; color: #8a674e; }
.error { border: 1px solid rgba(201,100,75,.22); background: #fff3ea; color: var(--rose); }
.success { border: 1px solid rgba(111,127,88,.28); background: #f3f7ed; color: #5c6f3f; }

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
}
.mobile-tabs { display: none; }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  border-radius: 0 28px 28px 0;
  border-left: 0;
  border-top: 0;
  border-bottom: 0;
  padding: 18px 14px;
  box-shadow: 0 0 90px rgba(108,74,53,.12);
}
.side-brand { display: flex; align-items: center; gap: 11px; padding: 6px 8px 20px; }
.side-brand strong { font-size: 16px; }
.side-nav { display: grid; gap: 6px; }
.nav-link {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: var(--radius);
  padding: 0 10px;
  color: #4b5963;
  font-weight: 720;
}
.nav-link.active, .nav-link:hover { background: #fff5e4; color: #9b3f2b; }
.account-box {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: rgba(255,255,255,.55);
}
.account-box b { display: block; overflow-wrap: anywhere; }
.account-box span { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; }
.main { min-width: 0; padding: 24px 28px 42px; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 20px;
}
.title h1 { margin: 0; font-size: 27px; letter-spacing: 0; }
.title h1,.chat-head h1,.panel h2{
  font-family:"Songti SC","STSong","Noto Serif CJK SC",serif;
}
.title p { margin: 7px 0 0; color: var(--muted); line-height: 1.55; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; margin-bottom: 18px; }
.metric { border: 1px solid rgba(184,134,70,.20); border-radius: 18px; padding: 16px; background: rgba(255,253,248,.78); box-shadow: var(--shadow2); }
.metric span { color: var(--muted); font-size: 12px; font-weight: 760; }
.metric b { display: block; margin-top: 8px; font-size: 25px; letter-spacing: 0; }
.agents { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.agent-card { padding: 18px; min-height: 238px; display: flex; flex-direction: column; justify-content: space-between; }
.agent-card header { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.agent-card h2 { margin: 0; font-size: 18px; letter-spacing: 0; }
.agent-card p { margin: 12px 0 0; color: var(--muted); line-height: 1.68; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 25px;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}
.badge.free { background: #f3f7ed; color: #5c6f3f; }
.badge.viral { background: #fff4df; color: #9b6330; }
.badge.paid { background: #fff2ea; color: #9b3f2b; }
.badge.off { background: #f3f4f5; color: #68717a; }
.agent-actions { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 16px; }
.panel { padding: 18px; margin-bottom: 16px; }
.panel h2 { margin: 0 0 14px; font-size: 18px; letter-spacing: 0; }

.chat-page { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.chat-panel { overflow: hidden; }
.chat-head { padding: 18px; border-bottom: 1px solid rgba(234,216,190,.72); display: flex; justify-content: space-between; gap: 14px; background: rgba(255,246,234,.65); }
.chat-head h1 { margin: 0; font-size: 21px; letter-spacing: 0; }
.chat-head p { margin: 8px 0 0; color: var(--muted); line-height: 1.58; }
.chat-head > .btn {
  align-self: flex-start;
  min-width: max-content;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  white-space: nowrap;
  flex: 0 0 auto;
}
.composer { padding: 18px; display: grid; gap: 12px; }
.output {
  min-height: 300px;
  border-top: 1px solid var(--line);
  background: rgba(255,246,234,.42);
  padding: 18px;
}
.empty { color: var(--muted); text-align: center; line-height: 1.8; padding: 58px 18px; }
.answer {
  max-width: 920px;
  white-space: pre-wrap;
  line-height: 1.76;
  border: 1px solid rgba(184,134,70,.20);
  border-radius: 18px;
  background: rgba(255,253,248,.88);
  padding: 16px;
}
.copy-output { margin-top: 12px; width: 100%; }
.side-panel { display: grid; gap: 16px; }
.steps { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.steps li { display: flex; gap: 10px; color: var(--muted); line-height: 1.55; }
.steps i { color: var(--brand); margin-top: 2px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 11px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: #50606b; font-size: 12px; font-weight: 800; background: #f8fafb; }
td { color: #26313a; }
tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: white; }
.toolbar { display: flex; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.admin-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }

@media (max-width: 980px) {
  .login, .shell, .chat-page { grid-template-columns: 1fr; }
  .sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    height: auto;
    border-radius: 0 0 28px 28px;
    border-right: 0;
    padding: 12px 14px;
  }
  .side-brand { padding: 4px 4px 6px; }
  .side-nav { display: none; }
  .account-box {
    position: static;
    margin-top: 8px;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 8px;
  }
  .account-box .btn { display: none; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .mobile-tabs {
    position: fixed;
    left: 50%;
    bottom: 0;
    z-index: 80;
    width: min(100%, 520px);
    transform: translateX(-50%);
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    gap: 4px;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom,0px));
    background: rgba(255,249,242,.94);
    backdrop-filter: blur(18px);
    border-top: 1px solid rgba(234,216,190,.8);
    box-shadow: 0 -14px 28px rgba(88,55,26,.08);
  }
  .mobile-tabs a,
  .mobile-tabs button {
    border: 0;
    background: transparent;
    min-height: 48px;
    display: grid;
    place-items: center;
    gap: 3px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 850;
  }
  .mobile-tabs .active { color: #9b3f2b; }
  .mobile-tabs button[disabled] { opacity: .45; }
  .main { padding-bottom: 90px; }
}

@media (max-width: 640px) {
  body { background: linear-gradient(180deg,#fffaf2 0%,#f7f1e8 52%,#ead8be 100%); }
  .login {
    min-height: 100vh;
    display: block;
    padding: 20px 14px 28px;
    width: 100%;
    max-width: 100vw;
    overflow: hidden;
  }
  .hero {
    min-height: auto;
    padding: 12px 4px 18px;
  }
  .hero .brand-mark { width: 40px; height: 40px; }
  .hero h1 {
    margin: 16px 0 10px;
    font-size: 34px;
    line-height: 1.1;
    overflow-wrap: anywhere;
    word-break: break-word;
  }
  .hero p {
    font-size: 16px;
    line-height: 1.65;
    font-weight: 760;
    overflow-wrap: anywhere;
    word-break: break-word;
  }
  .login-card { max-width: 100%; overflow: hidden; }
  .login-card {
    padding: 18px;
    border-radius: 26px;
  }
  .login-card h2 { font-size: 24px; }
  .entry-grid { grid-template-columns: 1fr; gap: 9px; }
  .entry-card {
    min-height: 118px;
    padding: 13px;
    border-radius: 20px;
  }
  .entry-card strong { font-size: 16px; }
  .entry-card small { font-size: 12px; }
  .entry-icon { width: 34px; height: 34px; border-radius: 13px; }
  .quick-codes .btn {
    min-height: 34px;
    padding: 0 10px;
    font-size: 12px;
  }
  .main { padding: 14px 14px 92px; }
  .topbar, .toolbar, .chat-head { flex-direction: column; align-items: stretch; }
  .metrics, .grid-2 { grid-template-columns: 1fr; }
  .metrics {
    grid-template-columns: repeat(2, 1fr);
    gap: 9px;
  }
  .metric {
    padding: 12px;
    border-radius: 18px;
  }
  .metric b { font-size: 20px; }
  .agents { grid-template-columns: 1fr; gap: 12px; }
  .agent-card {
    min-height: 190px;
    border-radius: 24px;
    padding: 16px;
  }
  .agent-card h2 { font-size: 18px; }
  .agent-card p { font-size: 13px; }
  .agent-actions .btn { width: 100%; min-height: 46px; }
  .chat-page { gap: 12px; }
  .chat-panel, .panel { border-radius: 24px; }
  .chat-head {
    padding: 16px;
    position: relative;
    top: auto;
    z-index: 10;
  }
  .chat-head h1 { font-size: 24px; }
  .chat-head h1,
  .chat-head p {
    padding-right: 76px;
  }
  .chat-head .btn {
    position: absolute;
    top: 14px;
    right: 14px;
    min-height: 34px;
    padding: 0 11px;
    border-radius: 999px;
    font-size: 0;
    background: rgba(255,246,234,.92);
    box-shadow: 0 8px 18px rgba(88,55,26,.08);
  }
  .chat-head .btn::after {
    content: "返回";
    font-size: 13px;
    font-weight: 900;
  }
  .composer {
    padding: 14px;
    gap: 10px;
  }
  .textarea {
    min-height: 170px;
    font-size: 16px;
  }
  .composer .btn.primary {
    min-height: 52px;
    font-size: 17px;
    border-radius: 18px;
  }
  .output {
    min-height: 260px;
    padding: 14px;
  }
  .answer {
    border-radius: 18px;
    padding: 14px;
    font-size: 15px;
    line-height: 1.75;
  }
  .side-panel { display: none; }
  table { font-size: 13px; }
}
