:root {
  --bg: #f5f3ef;
  --panel: #fffdfa;
  --ink: #27211d;
  --muted: #766d64;
  --line: #ded5ca;
  --brand: #9b1c1f;
  --brand-dark: #741316;
  --party-red: #8f1519;
  --gold: #b78b34;
  --emblem-gold: #d8a64f;
  --green: #28705d;
  --blue: #315d87;
  --danger: #b3261e;
  --radius: 8px;
  --shadow: 0 16px 36px rgba(68, 48, 31, 0.1);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(155, 28, 31, 0.08), transparent 42%),
    linear-gradient(315deg, rgba(183, 139, 52, 0.08), transparent 38%),
    var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei", "Noto Serif SC", SimSun, serif;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.login-shell {
  position: relative;
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 28px;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 18%, rgba(255, 231, 176, 0.42), transparent 28%),
    linear-gradient(115deg, rgba(143, 21, 25, 0.96) 0 36%, rgba(155, 28, 31, 0.78) 36% 48%, transparent 48%),
    linear-gradient(135deg, rgba(255, 247, 231, 0.9), rgba(247, 239, 225, 0.98));
}

.login-shell::before,
.member-shell::before,
.member-page::before {
  content: "";
  position: fixed;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 520 520'%3E%3Cg fill='none' stroke='%23d8a64f' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='260' cy='260' r='218' stroke-width='12' opacity='.52'/%3E%3Ccircle cx='260' cy='260' r='178' stroke-width='2' stroke-dasharray='10 15' opacity='.44'/%3E%3Cpath d='M138 318c98 96 258 58 301-73' stroke-width='34' opacity='.72'/%3E%3Cpath d='M176 295c70 56 163 36 215-34' stroke-width='18' opacity='.5'/%3E%3Cpath d='M238 135l73 170' stroke-width='32' opacity='.76'/%3E%3Cpath d='M210 146l158 66' stroke-width='30' opacity='.76'/%3E%3Cpath d='M361 202l-25 58' stroke-width='24' opacity='.76'/%3E%3C/g%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: contain;
  opacity: 0.2;
}

.login-shell::before {
  right: -118px;
  bottom: -132px;
  width: min(58vw, 560px);
  aspect-ratio: 1;
}

.login-shell::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(120deg, rgba(255, 255, 255, 0.08) 0 1px, transparent 1px 17px),
    linear-gradient(90deg, rgba(92, 12, 14, 0.18), transparent 46%);
}

.login-card, .panel {
  background: rgba(255, 253, 250, 0.95);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.login-card {
  position: relative;
  z-index: 1;
  width: min(440px, 100%);
  padding: 34px;
  border-top: 4px solid var(--emblem-gold);
  box-shadow: 0 22px 58px rgba(74, 17, 18, 0.2);
}

.brand-mark, .agent-orb {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 234, 176, 0.8), transparent 24%),
    linear-gradient(145deg, var(--party-red), var(--brand-dark));
  color: #fff;
  font-weight: 700;
  box-shadow: inset 0 0 0 2px rgba(216, 166, 79, 0.42);
}

.brand-mark { width: 44px; height: 44px; margin-bottom: 20px; }
.agent-orb { width: 64px; height: 64px; }

.eyebrow {
  color: var(--brand);
  font-size: 13px;
  font-weight: 700;
}

h1, h2, h3 { margin: 0; letter-spacing: 0; }
h1 { margin-top: 8px; font-size: 30px; }
h2 { font-size: 22px; }
h3 { font-size: 17px; }
p { color: var(--muted); line-height: 1.7; }

.form, .grid { display: grid; gap: 14px; }
.field { display: grid; gap: 7px; }
.field span { color: var(--muted); font-size: 13px; }
.input, .textarea, .select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 11px 12px;
  color: var(--ink);
}
.textarea { min-height: 94px; resize: vertical; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 14px;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
}
.btn:hover { background: var(--brand-dark); }
.btn.secondary { background: #fff; border-color: var(--line); color: var(--ink); }
.btn.secondary:hover { background: #f4eee7; }
.btn.danger { background: var(--danger); }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  background: rgba(255, 253, 250, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.topbar-title { display: flex; align-items: center; gap: 12px; font-weight: 800; }
.nav { display: flex; gap: 8px; flex-wrap: wrap; }
.nav a, .nav button {
  border: 0;
  background: transparent;
  padding: 8px 11px;
  border-radius: 6px;
  color: var(--muted);
}
.nav a:hover, .nav button:hover { background: #f1e9df; color: var(--brand); }

.page {
  position: relative;
  width: min(1180px, calc(100% - 32px));
  margin: 26px auto 48px;
}

.member-shell {
  position: relative;
}

.member-shell::before {
  right: -132px;
  top: 86px;
  width: min(62vw, 520px);
  aspect-ratio: 1;
  opacity: 0.11;
}

.member-page::before {
  right: -132px;
  top: 86px;
  width: min(62vw, 520px);
  aspect-ratio: 1;
  opacity: 0.11;
}

.page-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.panel { padding: 18px; }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stat { display: grid; gap: 10px; }
.stat strong { font-size: 30px; }
.stat span { color: var(--muted); }

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}
table { width: 100%; min-width: 760px; border-collapse: collapse; }
th, td { padding: 12px 13px; border-bottom: 1px solid #eee5da; text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: 13px; background: #fbf6ef; }

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  background: #f0e4d3;
  color: #674712;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.badge.red { background: #f8dddd; color: var(--danger); }
.badge.green { background: #dff0e9; color: var(--green); }
.badge.blue { background: #e0ebf6; color: var(--blue); }

.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.error { color: var(--danger); font-size: 13px; }
.success { color: var(--green); font-size: 13px; }

.agent-layout { display: grid; gap: 16px; }
.agent-hero { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 18px; }
.agent-prompt-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.agent-prompt {
  display: flex;
  align-items: center;
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}
.agent-prompt:hover { border-color: rgba(155, 28, 31, 0.45); background: #fff8f1; }
.agent-answer { border-color: rgba(155, 28, 31, 0.24); }
.agent-answer h3 { margin-top: 18px; color: var(--brand); }
.agent-step { padding: 10px 12px; border-left: 3px solid var(--brand); background: #fff8f1; color: var(--ink); }
.agent-note { padding: 9px 11px; border-left: 3px solid var(--gold); background: #fbf6ef; color: var(--ink); }
.agent-source { padding: 14px; border: 1px solid var(--line); border-radius: 6px; background: #fff; margin-top: 12px; }
.agent-source small { display: block; color: var(--muted); word-break: break-all; }

@media (max-width: 860px) {
  .grid.cols-4, .grid.cols-2, .agent-prompt-grid { grid-template-columns: 1fr; }
  .page-header, .topbar { align-items: flex-start; flex-direction: column; }
  .agent-hero { grid-template-columns: 1fr; }
  h1 { font-size: 25px; }
}
