:root {
  --bg: #ffffff;
  --bg-alt: #f7f8fa;
  --text: #1c1f24;
  --text-muted: #5a6270;
  --border: #e3e6ea;
  --accent: #1d5fd6;
  --accent-soft: #eaf1ff;
  --header-bg: #12203f;
  --header-text: #ffffff;
  --card-bg: #f7f8fa;
  --max-width: 1180px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a;
    --bg-alt: #1b1e24;
    --text: #e8eaed;
    --text-muted: #9aa2ad;
    --border: #2a2e36;
    --accent: #6ea2ff;
    --accent-soft: #1c2740;
    --header-bg: #0d1526;
    --header-text: #ffffff;
    --card-bg: #1b1e24;
  }
}

:root[data-theme="dark"] {
  --bg: #14161a;
  --bg-alt: #1b1e24;
  --text: #e8eaed;
  --text-muted: #9aa2ad;
  --border: #2a2e36;
  --accent: #6ea2ff;
  --accent-soft: #1c2740;
  --header-bg: #0d1526;
  --header-text: #ffffff;
  --card-bg: #1b1e24;
}

:root[data-theme="light"] {
  --bg: #ffffff;
  --bg-alt: #f7f8fa;
  --text: #1c1f24;
  --text-muted: #5a6270;
  --border: #e3e6ea;
  --accent: #1d5fd6;
  --accent-soft: #eaf1ff;
  --header-bg: #12203f;
  --header-text: #ffffff;
  --card-bg: #f7f8fa;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-size: 16px;
}

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

/* Header */
.site-header {
  background: var(--header-bg);
  color: var(--header-text);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.15);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.02em;
}

.brand-logo {
  height: 32px;
  width: 32px;
  object-fit: contain;
  border-radius: 6px;
  background: #ffffff;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--header-text);
  border-radius: 2px;
}

/* Layout */
.page {
  display: flex;
  align-items: flex-start;
  max-width: var(--max-width);
  margin: 0 auto;
  gap: 40px;
  padding: 32px 24px 0;
}

.toc {
  flex: 0 0 250px;
  position: sticky;
  top: 88px;
  align-self: flex-start;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}

.toc-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: toc-counter;
}

.toc li {
  counter-increment: toc-counter;
  margin-bottom: 4px;
}

.toc a {
  display: flex;
  gap: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.9rem;
  padding: 6px 8px;
  border-radius: 6px;
  transition: background 0.15s ease, color 0.15s ease;
}

.toc a::before {
  content: counter(toc-counter) ".";
  color: var(--text-muted);
  flex: 0 0 auto;
}

.toc a:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.content {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0 0 64px;
}

.content .container {
  padding: 0;
  max-width: 760px;
  margin: 0;
}

/* Typography */
h1 {
  font-size: 2.2rem;
  margin: 0 0 8px;
  line-height: 1.2;
}

h2 {
  font-size: 1.5rem;
  margin: 48px 0 16px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  scroll-margin-top: 88px;
}

section:first-of-type h2 {
  border-top: none;
}

h3 {
  font-size: 1.15rem;
  margin: 28px 0 10px;
  color: var(--accent);
  scroll-margin-top: 88px;
}

p {
  margin: 0 0 14px;
  color: var(--text);
}

.effective-date {
  color: var(--text-muted);
  margin-bottom: 24px;
  font-size: 0.95rem;
}

ul {
  margin: 0 0 16px;
  padding-left: 22px;
}

ul ul {
  margin-top: 8px;
  margin-bottom: 8px;
}

li {
  margin-bottom: 8px;
}

a {
  color: var(--accent);
}

.contact-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
  margin: 0 0 16px;
}

.contact-card p {
  margin: 0 0 6px;
}

.contact-card-title {
  font-weight: 700;
  margin-bottom: 10px !important;
  color: var(--accent);
}

.policy-footer-note {
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 24px 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Responsive */
@media (max-width: 900px) {
  .page {
    display: block;
    padding: 20px 20px 0;
  }

  .nav-toggle {
    display: flex;
  }

  .toc {
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    bottom: 0;
    max-height: none;
    border-radius: 0;
    transform: translateY(-12px);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.2s ease, opacity 0.2s ease;
    z-index: 40;
  }

  .toc.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .content .container {
    max-width: none;
  }
}

@media (max-width: 560px) {
  h1 {
    font-size: 1.7rem;
  }

  h2 {
    font-size: 1.3rem;
  }

  .container {
    padding: 0 16px;
  }

  .page {
    padding: 16px 16px 0;
  }
}
