:root, .dark {
  color-scheme: dark;
  --background: #181818;
  --foreground: #ffffff;
  --card: #1c1c1c;
  --card-foreground: #f5f5f5;
  --popover: #2a2a2a;
  --popover-foreground: #f5f5f5;
  --primary: #eeeeee;
  --primary-foreground: #202020;
  --secondary: #2a2a2a;
  --secondary-foreground: #dedede;
  --muted: #242424;
  --muted-foreground: #a3a3a3;
  --accent: #2f2f2e;
  --accent-foreground: #ffffff;
  --destructive: #f08087;
  --border: #2e2e2e;
  --input: #424242;
  --ring: #989898;
  --sidebar: #202020;
  --sidebar-foreground: #dedede;
  --sidebar-primary: #ececec;
  --sidebar-primary-foreground: #202020;
  --sidebar-accent: #303030;
  --sidebar-accent-foreground: #ececec;
  --sidebar-border: #303030;
  --sidebar-ring: #b5b5b5;
  --chart-1: #f08087;
  --chart-2: #62c7a6;
  --chart-3: #91bceb;
  --chart-4: #d8b477;
  --chart-5: #b7a2e8;
  --chart-grid: #2d2d2d;
  --chart-guide: #8d8d8d;
  --risk-surface: #2b2823;
  --risk-border: #514738;
  --risk-foreground: #cdb58d;
  --signal-surface: #2b2b2b;
  --link: #98b4ec;
  --radius: .6rem;
  --font-sans: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --font-mono: ui-monospace, 'SFMono-Regular', 'Cascadia Code', Consolas, monospace;
}

* { box-sizing: border-box; }
html {
  color-scheme: dark;
  background: var(--background);
  scrollbar-color: #626262 var(--background);
}
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background: var(--background);
  color: var(--foreground);
  font: 400 1rem/1.65 var(--font-sans);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
.topbar {
  padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
  background: var(--sidebar);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
}
.brand {
  align-self: flex-start;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  min-height: 64px;
  padding: 4px 8px;
  border-radius: 6px;
  color: var(--foreground);
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.5;
  text-decoration: none;
  overflow-wrap: anywhere;
}
.brand img { flex: 0 0 auto; width: 24px; height: 24px; }
.brand:hover { background: var(--muted); }
.module-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; min-width: 0; padding: 6px 0; min-height: 48px; }
.module-nav a, .section-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 6px 12px;
  border-radius: 6px;
  color: var(--muted-foreground);
  font-size: .875rem;
  line-height: 1.5;
  text-decoration: none;
}
.module-nav a:hover, .section-nav a:hover { background: var(--muted); color: var(--foreground); }
.module-nav a[aria-current="page"], .section-nav a[aria-current="page"] { background: var(--accent); color: var(--foreground); font-weight: 500; }
.workspace { display: grid; grid-template-columns: 192px minmax(0, 1fr); flex: 1; }
.sidebar { background: var(--sidebar); border-right: 1px solid var(--border); padding: 20px 12px; }
.sidebar h2 { font-size: .8125rem; font-weight: 400; line-height: 1.65; color: var(--muted-foreground); margin: 0 8px 12px; }
.section-nav { display: flex; flex-direction: column; gap: 4px; }
.skip-link { position: fixed; top: 8px; left: 16px; z-index: 1; transform: translateY(-200%); padding: 8px 12px; border-radius: 6px; background: var(--primary); color: var(--primary-foreground); }
.skip-link:focus { transform: translateY(0); }
main {
  min-width: 0;
  width: 100%;
  max-width: 1476px;
  margin: 0 auto;
  padding: 24px 28px max(20px, env(safe-area-inset-bottom));
}
h1 { margin: 0 0 8px; font-size: 1.5rem; font-weight: 600; line-height: 1.5; letter-spacing: 0; color: var(--foreground); }
p { margin: 0; font-size: .9375rem; font-weight: 400; line-height: 1.8; color: var(--muted-foreground); }
:where(button, a, input, select, textarea, summary):focus-visible {
  outline: 3px solid var(--ring);
  outline-offset: 3px;
}
:where(button, a, input, select, textarea) {
  transition: background-color 120ms ease, color 120ms ease, border-color 120ms ease;
}
::selection { background: #505050; color: #fff; }
@media (max-width: 800px) {
  .topbar { padding-left: max(8px, env(safe-area-inset-left)); padding-right: max(8px, env(safe-area-inset-right)); }
  .topbar-inner { flex-direction: column; align-items: stretch; gap: 8px; }
  .brand { align-self: flex-start; }
  .module-nav a, .section-nav a { min-height: 44px; }
  .workspace { display: flex; flex-direction: column; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--border); padding: 12px 8px; }
  .sidebar h2 { margin-bottom: 4px; }
  .section-nav { flex-direction: row; flex-wrap: wrap; }
  main { flex: 1; }
  main { padding-left: 16px; padding-right: 16px; }
  h1 { font-size: 1.375rem; }
}
@media (prefers-reduced-motion: reduce) {
  :where(button, a, input, select, textarea) { transition: none; }
}

.policy-card{max-width:900px;margin-top:24px;padding:24px;background:var(--card);border:1px solid var(--border);border-radius:8px}.policy-card h2{font-size:1.25rem;line-height:1.6;margin:8px 0 12px}.policy-card h2 a{color:var(--foreground);text-decoration:none}.policy-card p{margin:8px 0;color:var(--muted-foreground);font-size:.875rem}.policy-card .policy-tag{font-size:.8125rem}.policy-open{display:inline-block;margin-top:20px;color:var(--foreground);text-underline-offset:4px}
