:root {
  --bg: #f7f1e3;
  --paper: rgba(255, 251, 244, 0.9);
  --ink: #1d2a33;
  --muted: #6d7b84;
  --line: rgba(29, 42, 51, 0.12);
  --accent: #c4682c;
  --accent-deep: #934818;
  --accent-soft: #f3dcc5;
  --good: #236648;
  --bad: #9c5548;
  --shadow: 0 20px 60px rgba(73, 47, 24, 0.12);
  --radius: 24px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(196, 104, 44, 0.18), transparent 28%),
    radial-gradient(circle at bottom right, rgba(35, 102, 72, 0.12), transparent 24%),
    linear-gradient(180deg, #fbf7ef 0%, #f2ead9 100%);
  font-family: "Microsoft YaHei UI", "PingFang SC", "Noto Sans SC", sans-serif;
}

button,
input {
  font: inherit;
}

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

.sidebar {
  padding: 32px 24px;
  color: #fffaf2;
  background:
    linear-gradient(180deg, rgba(20, 31, 40, 0.92), rgba(35, 58, 71, 0.96)),
    linear-gradient(135deg, rgba(196, 104, 44, 0.4), transparent);
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar h1 {
  margin: 10px 0 14px;
  font-size: 34px;
  line-height: 1.06;
}

.sidebar-copy {
  margin: 0 0 24px;
  line-height: 1.7;
  color: rgba(255, 250, 242, 0.8);
}

.sidebar-panel {
  margin-top: 18px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(14px);
}

.sidebar-panel--accent {
  background: linear-gradient(180deg, rgba(196, 104, 44, 0.18), rgba(255, 255, 255, 0.04));
}

.sidebar-panel__label,
.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 12px;
  color: var(--muted);
}

.sidebar .eyebrow,
.sidebar-panel__label {
  color: rgba(255, 250, 242, 0.65);
}

.role-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.role-tab,
.toolbar-btn {
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, color 160ms ease;
}

.role-tab {
  color: #fffaf2;
  background: rgba(255, 255, 255, 0.08);
}

.role-tab.is-active {
  color: #fff;
  background: linear-gradient(135deg, #d97a36, #ba5920);
  box-shadow: 0 10px 25px rgba(196, 104, 44, 0.28);
}

.role-tab:hover,
.toolbar-btn:hover {
  transform: translateY(-1px);
}

.tips {
  margin: 12px 0 0;
  padding-left: 18px;
  color: rgba(255, 250, 242, 0.82);
  line-height: 1.7;
}

.content {
  padding: 28px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 24px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 32px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.hero h2 {
  margin: 10px 0 12px;
  font-size: 42px;
  line-height: 1.05;
}

.hero-copy {
  margin: 0;
  max-width: 58ch;
  line-height: 1.7;
  color: var(--muted);
}

.hero-actions {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.search {
  display: grid;
  gap: 10px;
  color: var(--muted);
}

.search input {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid rgba(29, 42, 51, 0.14);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.toolbar-btn {
  color: var(--ink);
  background: rgba(29, 42, 51, 0.08);
}

.toolbar-btn--primary {
  color: #fff8ef;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.stat-card,
.tool-card,
.group-panel,
.empty-state {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.stat-card {
  padding: 22px;
}

.stat-label {
  display: block;
  color: var(--muted);
  font-size: 14px;
}

.stat-value {
  display: block;
  margin-top: 10px;
  font-size: 34px;
}

.stat-note {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
}

.tool-section,
.module-section {
  margin-top: 18px;
}

.tool-card {
  padding: 22px;
}

.tool-card__header,
.module-card__header,
.group-panel__summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.tool-card__header h3,
.group-panel__summary h3,
.module-card__header h4 {
  margin: 8px 0 0;
}

.group-panel {
  overflow: hidden;
  margin-bottom: 16px;
}

.group-panel__summary {
  list-style: none;
  padding: 20px 22px;
  cursor: pointer;
}

.group-panel__summary::-webkit-details-marker {
  display: none;
}

.group-count,
.module-state {
  flex-shrink: 0;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 13px;
}

.group-count {
  color: var(--muted);
  background: rgba(29, 42, 51, 0.06);
}

.module-state.is-enabled {
  color: #f8fff8;
  background: var(--good);
}

.module-state.is-disabled {
  color: #fff5f1;
  background: var(--bad);
}

.module-list {
  display: grid;
  gap: 14px;
  padding: 0 22px 22px;
}

.module-card {
  padding: 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(29, 42, 51, 0.08);
}

.perm-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.perm-chip {
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--muted);
  background: rgba(29, 42, 51, 0.07);
}

.perm-chip.is-enabled {
  color: #194630;
  background: rgba(35, 102, 72, 0.14);
}

.empty-state {
  padding: 28px;
  text-align: center;
  color: var(--muted);
}

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

  .sidebar {
    position: static;
    height: auto;
  }

  .hero {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .content,
  .sidebar {
    padding: 18px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .hero h2 {
    font-size: 32px;
  }

  .toolbar {
    flex-direction: column;
  }
}
