/* CSS 变量定义：统一管理颜色、尺寸等设计令牌 */
:root {
  --bg: #f6f7fb;                    /* 背景色 */
  --card: #ffffff;                  /* 卡片背景色 */
  --line: #e8e9ee;                  /* 边框颜色 */
  --text: #1f2430;                  /* 主文本颜色 */
  --muted: #6c7280;                 /* 次要文本颜色 */
  --accent: #3a7cff;                /* 主题色 */
  --accent-weak: #e8f0ff;           /* 主题色弱化版 */
  --shadow: 0 12px 35px rgba(32, 58, 97, 0.12);  /* 阴影 */
  --radius: 14px;                   /* 圆角半径 */
  --nav-width: 78px;                /* 一级导航栏宽度 */
  --secondary-width: 260px;         /* 二级导航栏宽度 */
  --secondary-collapsed: 90px;      /* 二级导航栏折叠后宽度 */
  --content-max: 1280px;            /* 内容区域最大宽度 */
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Helvetica Neue", "Segoe UI", "PingFang SC", "Noto Sans SC", sans-serif;
  background: radial-gradient(circle at 10% 20%, rgba(58, 124, 255, 0.12), transparent 22%),
              radial-gradient(circle at 80% 0%, rgba(78, 196, 255, 0.08), transparent 28%),
              var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.bg-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(58, 124, 255, 0.04), rgba(255, 255, 255, 0));
}

.page {
  position: relative;
  min-height: 100vh;
}

.landing {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 56px 24px 24px;
}

.landing-inner {
  display: flex;
  justify-content: center;
  max-width: 800px;
  margin: 0 auto;
}

.hero {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow);
}

.hero h1 {
  margin: 6px 0 12px;
  font-size: clamp(28px, 4vw, 38px);
  line-height: 1.2;
}

.subtitle {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.6;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--accent-weak);
  color: var(--accent);
  border-radius: 999px;
  font-weight: 600;
  font-size: 13px;
}

.feature-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 18px 0 12px;
}

.chip {
  padding: 10px 12px;
  background: #f1f4fb;
  border: 1px solid #e2e8f4;
  border-radius: 999px;
  font-size: 13px;
  color: var(--muted);
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 12px 0 8px;
}

.helper-text {
  color: var(--muted);
  font-size: 14px;
}

.hero-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.panel-title {
  font-size: 18px;
  font-weight: 700;
}

.panel-subtitle {
  color: var(--muted);
  font-size: 14px;
}

.panel-body {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

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

.steps.inline {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  margin-top: 12px;
}

.step {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
}

.step-index {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-weak);
  color: var(--accent);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.step-title {
  font-weight: 700;
  color: var(--text);
}

.step-desc {
  color: var(--muted);
  font-size: 13px;
}

.preview-card {
  border: 1px dashed #d7dded;
  border-radius: var(--radius);
  padding: 16px;
  background: #f8faff;
  display: grid;
  gap: 6px;
}

.code-preview {
  letter-spacing: 10px;
  font-size: 28px;
  font-weight: 800;
  color: var(--text);
}

.preview-tip {
  color: var(--muted);
  font-size: 13px;
}

.icp-line {
  margin-top: 18px;
  color: var(--muted);
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  font-size: 13px;
}

.icp-line a {
  color: var(--muted);
  text-decoration: none;
}

.icp-line a:hover {
  color: var(--text);
}

.police-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.police-link img {
  width: 16px;
  height: 16px;
}

.divider {
  color: #d3d6de;
}

.btn {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease, color 0.2s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--text);
  background: #f3f5fb;
}

.btn.primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 10px 30px rgba(58, 124, 255, 0.25);
  border-color: var(--accent);
}

.btn.ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--text);
}

.btn.block {
  width: 100%;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn:not(:disabled):hover {
  transform: translateY(-2px);
}

/* 应用主界面布局：三栏布局（一级导航 + 二级导航 + 内容区域） */
.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--nav-width) var(--secondary-width) 1fr;
  background: #eef1f7;
}

/* 二级导航栏折叠时的布局调整 */
.app-shell.secondary-collapsed {
  grid-template-columns: var(--nav-width) var(--secondary-collapsed) 1fr;
}

.primary-nav {
  background: #fdfdff;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 16px 8px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.nav-top {
  display: grid;
  gap: 16px;
}

.avatar-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #f1f4fb;
  color: var(--text);
  font-weight: 800;
  cursor: pointer;
}

.avatar-initial {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.avatar-fallback {
  display: none;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.avatar-emoji {
  font-size: 24px;
  line-height: 1;
}

.nav-group {
  display: grid;
  gap: 8px;
}

.nav-item {
  width: 100%;
  border: none;
  background: transparent;
  padding: 10px 8px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.nav-item .nav-icon {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: #f1f3f7;
  display: grid;
  place-items: center;
  font-weight: 700;
}

.nav-item .nav-label {
  font-size: 12px;
  margin-top: 6px;
}

.nav-item:hover {
  background: #eef2fb;
  color: var(--text);
}

.nav-item.active {
  background: var(--accent-weak);
  color: var(--accent);
}

.nav-item.ghost .nav-icon {
  background: transparent;
}

.nav-bottom {
  display: grid;
  gap: 8px;
}

/* 二级导航栏：根据一级模块显示子功能列表 */
.secondary-nav {
  background: #f9fbff;
  border-right: 1px solid var(--line);
  padding: 18px 16px;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 16px;
  transition: width 0.2s ease;
}

.secondary-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.secondary-title {
  font-size: 16px;
  font-weight: 800;
}

.collapse-btn {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  color: var(--muted);
}

.secondary-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.secondary-item {
  padding: 10px 12px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
  text-align: left;
  font-size: 14px;
  transition: background 0.15s ease, color 0.15s ease;
}

.secondary-item:hover {
  background: rgba(58, 124, 255, 0.08);
  color: var(--text);
}

.secondary-item.active {
  background: var(--accent-weak);
  color: var(--accent);
  font-weight: 600;
}

.data-table-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.toggle-icon {
  font-size: 12px;
  transition: transform 0.2s ease;
}

.data-table-list {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  padding-left: 12px;
}

.data-table-list.expanded {
  max-height: 1000px;
}

.data-table-item {
  display: block;
  width: 100%;
  font-size: 13px;
  padding-left: 24px;
}

.secondary-nav.collapsed {
  width: var(--secondary-collapsed);
}

.secondary-nav.collapsed .secondary-list,
.secondary-nav.collapsed .secondary-title {
  display: none;
}

.secondary-nav.collapsed .collapse-btn {
  transform: rotate(180deg);
}

.main-area {
  padding: 32px;
}

.content-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  min-height: calc(100vh - 64px);
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 16px;
}

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

.content-title {
  font-size: 22px;
  font-weight: 800;
}

.content-subtitle {
  color: var(--muted);
  font-size: 14px;
}

.content-placeholder {
  background: #f8faff;
  border: 1px dashed #d7dded;
  border-radius: var(--radius);
  padding: 20px;
  display: grid;
  gap: 8px;
}

.placeholder-title {
  font-size: 18px;
  font-weight: 700;
}

.placeholder-desc {
  color: var(--muted);
  margin: 0;
}

.content-admin {
  background: #f8faff;
  border: 1px solid #d7dded;
  border-radius: var(--radius);
  padding: 18px;
  display: grid;
  gap: 12px;
}

.admin-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.admin-title {
  font-size: 18px;
  font-weight: 800;
}

.admin-hint {
  color: var(--muted);
  font-size: 13px;
}

.table-wrapper {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 26px rgba(40, 65, 110, 0.08);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.data-table thead {
  background: #f3f6fc;
  color: var(--muted);
}

.data-table th,
.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.data-table tbody tr:hover {
  background: #f9fbff;
}

.table-empty {
  padding: 14px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

.account-popover {
  position: fixed;
  left: calc(var(--nav-width) + 12px);
  top: 20px;
  width: 220px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 35px rgba(32, 58, 97, 0.16);
  padding: 14px;
  display: grid;
  gap: 6px;
  z-index: 20;
}

.account-name {
  font-weight: 800;
}

.account-id {
  color: var(--muted);
  font-size: 14px;
}

.hidden {
  display: none !important;
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 30;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.modal-card {
  position: relative;
  background: #fff;
  border-radius: 16px;
  border: 1px solid var(--line);
  box-shadow: 0 30px 80px rgba(17, 38, 83, 0.25);
  width: min(780px, 92vw);
  padding: 24px;
  display: grid;
  gap: 16px;
  z-index: 1;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

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

.modal-title {
  font-size: 20px;
  font-weight: 800;
}

.close-btn {
  border: 1px solid var(--line);
  background: #f8faff;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 18px;
}

.modal-body {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.code-panel {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  background: #f9fbff;
  display: grid;
  gap: 10px;
}

.code-display {
  letter-spacing: 12px;
  font-size: 34px;
  font-weight: 900;
  text-align: center;
}

.timer {
  color: var(--muted);
  text-align: center;
}

.status {
  font-weight: 700;
  text-align: center;
}

.status.muted {
  font-weight: 400;
  color: var(--muted);
}

.modal-actions {
  display: grid;
  gap: 10px;
}

.hint {
  color: var(--muted);
  font-size: 13px;
  margin: 0;
}

@media (max-width: 960px) {
  .app-shell {
    grid-template-columns: var(--nav-width) 1fr;
  }
  .secondary-nav {
    display: none;
  }
}

@media (max-width: 720px) {
  .landing {
    padding: 32px 16px;
  }
  .content-card {
    min-height: auto;
  }
  .main-area {
    padding: 20px;
  }
}
