:root {
  --bg: #f7f1e7;
  --bg-strong: #f0e5d6;
  --panel: rgba(255, 250, 242, 0.88);
  --ink: #212121;
  --muted: #6d665f;
  --line: rgba(33, 33, 33, 0.1);
  --orange: #d96b27;
  --blue: #1766b1;
  --green: #1d7b52;
  --danger: #b6423b;
  --shadow: 0 22px 60px rgba(75, 52, 37, 0.12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(217, 107, 39, 0.16), transparent 26rem),
    radial-gradient(circle at top right, rgba(23, 102, 177, 0.12), transparent 24rem),
    linear-gradient(180deg, #fbf6ef 0%, var(--bg) 100%);
  font-family: "Aptos", "Segoe UI Variable", "PingFang SC", "Microsoft YaHei", sans-serif;
}

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

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
}

.sidebar {
  padding: 28px 22px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 250, 242, 0.96), rgba(248, 239, 228, 0.9));
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 28px;
}

.brand h1, .panel h3, .topbar h2 {
  margin: 0;
  font-family: "Iowan Old Style", "Songti SC", serif;
}

.brand p, .muted, .eyebrow, .sidebar-note p { margin: 0; color: var(--muted); }

.brand-badge {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--orange), #ecb04f);
  color: white;
  font-weight: 700;
  box-shadow: 0 16px 30px rgba(217, 107, 39, 0.24);
}

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

.nav-link {
  border: 0;
  border-radius: 14px;
  text-align: left;
  padding: 14px 16px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}

.nav-link:hover, .nav-link.active {
  background: rgba(33, 33, 33, 0.06);
  transform: translateX(4px);
}

.sidebar-note {
  margin-top: 24px;
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.42);
  border: 1px solid rgba(33, 33, 33, 0.07);
}

.pill {
  display: inline-flex;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(29, 123, 82, 0.14);
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
}

.content { padding: 28px; }

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
  margin-bottom: 22px;
}

.eyebrow {
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 12px;
}

.topbar-actions { display: flex; gap: 12px; }

.page { display: none; }
.page.active { display: block; }

.stats-grid, .panel-grid {
  display: grid;
  gap: 18px;
  margin-bottom: 18px;
}

.stats-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.panel-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.panel, .stat-card {
  border: 1px solid rgba(33, 33, 33, 0.08);
  background: var(--panel);
  backdrop-filter: blur(10px);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.stat-card { padding: 20px; }
.accent-orange { background: linear-gradient(180deg, rgba(255, 247, 240, 0.95), rgba(255, 236, 220, 0.8)); }
.accent-blue { background: linear-gradient(180deg, rgba(241, 248, 255, 0.95), rgba(224, 240, 255, 0.8)); }
.accent-green { background: linear-gradient(180deg, rgba(241, 252, 247, 0.95), rgba(226, 246, 236, 0.8)); }
.accent-ink { background: linear-gradient(180deg, rgba(248, 245, 241, 0.95), rgba(237, 230, 224, 0.88)); }

.stat-card span, .stat-card small { display: block; }
.stat-card strong { display: block; font-size: 40px; margin: 10px 0 8px; }

.panel { padding: 22px; }
.panel.tall { min-height: 360px; }

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 18px;
}

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

.field, .checkbox-field { display: grid; gap: 8px; }
.wide { grid-column: 1 / -1; }

input, select, textarea {
  width: 100%;
  border: 1px solid rgba(33, 33, 33, 0.12);
  border-radius: 14px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
}

textarea { resize: vertical; min-height: 108px; }

.checkbox-field {
  grid-template-columns: 20px 1fr;
  align-items: center;
}

.checkbox-field input {
  width: 18px;
  height: 18px;
  margin: 0;
}

.form-actions, .inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.inline-form input, .inline-form select { flex: 1 1 180px; }

.primary-button, .ghost-button, .copy-button {
  border-radius: 999px;
  padding: 12px 18px;
  cursor: pointer;
}

.primary-button {
  border: 0;
  color: white;
  background: linear-gradient(135deg, var(--orange), #c1471e);
}

.ghost-button {
  border: 1px solid rgba(33, 33, 33, 0.12);
  background: rgba(255, 255, 255, 0.6);
}

.result-box {
  margin-top: 18px;
  border-radius: 18px;
  padding: 16px;
  border: 1px dashed rgba(33, 33, 33, 0.16);
  background: rgba(255, 255, 255, 0.45);
  white-space: pre-wrap;
  word-break: break-word;
}

.result-box.empty { color: var(--muted); }

.result-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

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

.timeline-item {
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(33, 33, 33, 0.08);
}

.timeline-item strong { display: block; margin-bottom: 6px; }

.table-wrap { overflow: auto; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid rgba(33, 33, 33, 0.08);
  vertical-align: top;
}
th { color: var(--muted); font-weight: 600; }

.badge {
  display: inline-flex;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 700;
}

.badge.success { color: var(--green); background: rgba(29, 123, 82, 0.12); }
.badge.warning { color: var(--orange); background: rgba(217, 107, 39, 0.12); }
.badge.danger { color: var(--danger); background: rgba(182, 66, 59, 0.12); }

.pie-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 24px;
  align-items: center;
  min-height: 250px;
}

.pie-chart {
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: conic-gradient(var(--orange) 0 100%);
  position: relative;
  margin: 0 auto;
}

.pie-chart::after {
  content: "";
  position: absolute;
  inset: 34px;
  border-radius: 50%;
  background: rgba(255, 250, 242, 0.96);
}

.legend { display: grid; gap: 12px; }
.legend-item { display: flex; align-items: center; gap: 10px; }
.legend-swatch { width: 12px; height: 12px; border-radius: 50%; }

.trend-chart { min-height: 280px; }
.trend-svg { width: 100%; height: 280px; }

.copy-button {
  border: 0;
  background: rgba(23, 102, 177, 0.1);
  color: var(--blue);
}

.code-inline {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(33, 33, 33, 0.07);
  font-family: "Cascadia Code", "Consolas", monospace;
  font-size: 12px;
}

@media (max-width: 1100px) {
  .shell, .stats-grid, .panel-grid, .form-grid, .pie-layout { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}
