/* finesse · register=product · palette=tea-matcha-ramp · shell=sidebar+float-dashboard
 * SOUL=6 SPECTACLE=2 DENSITY=8 */
:root {
  --text-on-primary: #FDFCF9;
  --primary: #3EC583;
  --primary-dark: #2D7A52;
  --primary-light: #B8D4A8;
  --primary-surface: rgba(62, 197, 131, 0.09);
  --secondary: #F2F7EE;
  --accent-soft: rgba(62, 197, 131, 0.11);
  --canvas: #F5F3EF;
  --surface: #FDFCF9;
  --surface-muted: #FAF9F6;
  --card: #FDFCF9;
  --card-subtle: #F6F8F5;
  --ink: #1A1D1A;
  --ink1: #1A1D1A;
  --ink2: #687266;
  --ink3: #9BA397;
  --border: #E4E1D8;
  --border-soft: rgba(22, 32, 25, 0.085);
  --border-hairline: rgba(22, 32, 25, 0.085);
  --divider: #DDD8CF;
  --success: #2F9E6B;
  --warning: #D4A843;
  --warn: #D4A843;
  --error: #C96B6B;
  --danger: #DC2626;
  --info: #5A8F7B;
  --sidebar-bg: #161816;
  --sidebar-active-bg: #232823;
  --sidebar-text: #BDB9B1;
  --sidebar-active-text: #B8D4A8;
  --shadow-soft: 0 2px 10px rgba(18, 32, 24, 0.04), 0 1px 2px rgba(18, 32, 24, 0.03);
  --shadow-float: 0 24px 60px -24px rgba(18, 32, 24, 0.16);
  --radius-card: 14px;
  --radius-nested: 10px;
  --radius-control: 8px;
  --radius-btn: 8px;
  --nav-width: 256px;
  --titlebar-h: 60px;
  --font: "Inter", "Noto Sans SC", "Segoe UI", system-ui, sans-serif;
  --tabular: "Inter", "Noto Sans SC", ui-monospace, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink1);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

.app {
  display: grid;
  grid-template-columns: var(--nav-width) 1fr;
  grid-template-rows: var(--titlebar-h) 1fr;
  height: 100vh;
  overflow: hidden;
}

.titlebar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border-hairline);
  z-index: 10;
}
.titlebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: calc(var(--nav-width) - 16px);
}
.logo {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  flex-shrink: 0;
}
.titlebar-brand h1 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.2px;
}
.titlebar-brand span {
  display: block;
  font-size: 11px;
  color: var(--ink2);
  font-weight: 500;
}
.search-wrap {
  flex: 1;
  max-width: 448px;
}
.search {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 14px;
  background: var(--surface-muted);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-control);
  color: var(--ink2);
  transition: box-shadow 0.2s, border-color 0.2s;
}
.search:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(62, 197, 131, 0.2);
}
.search input {
  flex: 1;
  border: none;
  background: transparent;
  font: inherit;
  color: var(--ink1);
  outline: none;
}
.search input::placeholder { color: var(--ink3); }
.search kbd {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--secondary);
  color: var(--ink2);
  border: 1px solid var(--border-hairline);
}
.titlebar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
.icon-btn {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--ink2);
  cursor: pointer;
  display: grid;
  place-items: center;
}
.icon-btn:hover { background: var(--secondary); color: var(--ink1); }

.nav {
  background: linear-gradient(180deg, #131B16 0%, #0F1511 100%);
  border-right: 1px solid rgba(255, 255, 255, 0.07);
  color: #C4CEC7;
  padding: 8px 10px 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-group {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #6B7B71;
  padding: 9px 10px 3px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.nav-group:first-child { padding-top: 2px; }
.nav-group::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.06), transparent);
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 33px;
  padding: 0 10px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: #C2CCC5;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  position: relative;
  width: 100%;
}
.nav-item svg { width: 17px; height: 17px; opacity: 0.78; flex-shrink: 0; transition: color 0.16s, opacity 0.16s; }
.nav-item:hover { background: rgba(255, 255, 255, 0.055); color: #F0F5F2; }
.nav-item:hover svg { opacity: 1; color: #95D5B2; }
.nav-item.active {
  background: linear-gradient(90deg, rgba(62, 197, 131, 0.18) 0%, rgba(62, 197, 131, 0.05) 100%);
  box-shadow: inset 0 0 0 1px rgba(116, 198, 157, 0.22);
  color: #F2F9F5;
  font-weight: 600;
}
.nav-item.active svg { opacity: 1; color: #74C69D; }
.nav-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 7px;
  bottom: 7px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: #52B788;
  box-shadow: 0 0 8px rgba(82, 183, 136, 0.65);
}
.nav-proto {
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.nav-item.disabled {
  opacity: 0.45;
  cursor: default;
  pointer-events: none;
}
.proto-banner {
  display: none;
  font-size: 11px;
  color: var(--ink2);
  background: var(--secondary);
  padding: 6px 32px;
  border-bottom: 1px solid var(--border-hairline);
}
body.dev-mode .proto-banner { display: block; }
.proto-toggle {
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 6px;
  color: #A3B0A8;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 6px;
  text-align: center;
  white-space: nowrap;
  transition: all 0.16s ease;
}
.proto-toggle:hover, .proto-toggle.active {
  background: rgba(82, 183, 136, 0.14);
  border-color: rgba(116, 198, 157, 0.3);
  color: #E8F5EE;
}

.main {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  background: var(--canvas);
}
.proto-banner { flex-shrink: 0; }
.scene-host {
  flex: 1 1 0%;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  position: relative;
}
.scene { display: none; height: 100%; box-sizing: border-box; }
.scene.active {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  overflow: hidden;
}
.scene.active > * { flex-shrink: 0; }
#scene-dashboard.scene.active,
#scene-statistics.scene.active {
  display: block;
  overflow-y: auto;
}

.list-card {
  background: var(--surface);
  border-radius: var(--radius-card);
  border: 1px solid var(--border-hairline);
  box-shadow: var(--shadow-soft);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--radius-btn);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  white-space: nowrap;
  transition: background 0.16s, box-shadow 0.16s, border-color 0.16s;
}
.btn-primary {
  background: var(--primary);
  color: var(--text-on-primary);
}
.btn-success-filled {
  background: var(--success);
  color: var(--text-on-primary);
}
.btn-success-filled:hover {
  filter: brightness(0.95);
  box-shadow: 0 0 0 4px rgba(47, 158, 107, 0.22);
}
.btn-primary:hover {
  background: var(--primary-dark);
  box-shadow: 0 0 0 4px rgba(62, 197, 131, 0.25);
}
.btn-secondary {
  background: var(--surface);
  border-color: var(--border-hairline);
  color: var(--ink1);
}
.btn-secondary:hover { background: var(--surface-muted); }
.btn-success-outline {
  background: rgba(47, 158, 107, 0.1);
  color: var(--success);
  border-color: rgba(47, 158, 107, 0.35);
}
.btn-danger {
  background: var(--error);
  color: var(--text-on-primary);
}
.btn:focus-visible,
.field:focus-visible,
.textbox:focus-visible,
.nav-item:focus-visible,
.icon-btn:focus-visible,
.search input:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
.btn-sm { height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 8px; }

.page-padding { padding: 16px 24px 18px; }
.breadcrumb {
  font-size: 12.5px;
  color: var(--ink2);
  margin-bottom: 6px;
}
.breadcrumb a { color: var(--ink2); text-decoration: none; }
.breadcrumb a:hover { color: var(--primary-dark); }
.breadcrumb .current { color: var(--ink1); font-weight: 600; }

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}
.page-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 750;
  letter-spacing: -0.02em;
  color: var(--ink1);
}
.page-header p {
  margin: 4px 0 0;
  font-size: 12.5px;
  color: var(--ink2);
}
.page-header-actions { display: flex; gap: 8px; flex-shrink: 0; align-items: center; }

/* ─── Round 4 跨页面深水区 UI/UX 范式统一规则 ─── */
/* 1. 复选框/单选框品牌色与表格首列对齐同构 */
input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--primary);
  width: 15px;
  height: 15px;
  cursor: pointer;
  vertical-align: middle;
}
.data-table th:first-child:has(input[type="checkbox"]),
.data-table td:first-child:has(input[type="checkbox"]) {
  width: 40px !important;
  text-align: center !important;
  padding-left: 10px !important;
  padding-right: 6px !important;
}

/* 2. 全站空状态 (.empty-state) 视觉图标与层级同构 */
.empty-state:not(:has(svg))::before {
  content: "🍃";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
  border-radius: 50%;
  background: var(--primary-surface);
  border: 1px solid rgba(45, 122, 82, 0.18);
  font-size: 20px;
  box-shadow: var(--shadow-xs);
}

/* 3. 成员管理角色 KPI 卡片 (.member-kpi-card) 悬停与选中高亮同构 */
.member-kpi-card {
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}
.member-kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: rgba(45, 122, 82, 0.38) !important;
}
.member-kpi-card.active {
  border-color: var(--primary) !important;
  background: linear-gradient(180deg, rgba(62, 197, 131, 0.09) 0%, var(--card) 100%) !important;
  box-shadow: 0 0 0 2px rgba(45, 122, 82, 0.15);
}

/* 4. 侧拉抽屉家族 (.ai-drawer-head & .proto-drawer-head) 头部同构 */
.ai-drawer-head,
.proto-drawer-head {
  min-height: 60px;
  padding: 14px 20px;
  background: var(--card);
  border-bottom: 1px solid var(--border-hairline);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* 5. 页头刷新与导出按钮图标视觉同构 */
.page-header-actions button[id*="refresh"]:not(:has(svg))::before {
  content: "↻";
  display: inline-block;
  margin-right: 5px;
  font-size: 14px;
  font-weight: 700;
  transition: transform 0.35s ease;
}
.page-header-actions button[id*="refresh"]:hover::before,
.page-header-actions button[id*="refresh"]:hover .refresh-icon {
  transform: rotate(180deg);
}
.refresh-icon {
  transition: transform 0.35s ease;
}
#btn-export-articles-csv:not(:has(svg))::before {
  content: "⬇";
  display: inline-block;
  margin-right: 5px;
  font-size: 12px;
}


