:root {
  --bg-color: #0d1117;
  --surface-color: #161b22;
  --surface-light: #21262d;
  --card-bg: #1c2128;
  --border-color: #30363d;
  --primary-color: #ff9500;
  --primary-light: #ffad33;
  --accent-blue: #58a6ff;
  --accent-green: #3fb950;
  --text-primary: #c9d1d9;
  --text-secondary: #8b949e;
  --text-muted: #6e7681;
  --font-stack: 'Sarabun', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --container-max-width: 1040px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-color);
  color: var(--text-primary);
  font-family: var(--font-stack);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--accent-blue);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--primary-color);
  text-decoration: underline;
}

/* Header & Navigation */
.policy-header {
  background-color: var(--surface-color);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-container {
  max-width: var(--container-max-width);
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: linear-gradient(135deg, #ff9500, #e68600);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #0d1117;
  font-size: 16px;
  box-shadow: 0 0 12px rgba(255, 149, 0, 0.3);
}

.brand-title {
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.5px;
}

.brand-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.back-app-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 14px;
  font-weight: 600;
  background-color: var(--surface-light);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  text-decoration: none;
  transition: all 0.2s ease;
}

.back-app-btn:hover {
  background-color: var(--primary-color);
  color: #0d1117;
  border-color: var(--primary-color);
  text-decoration: none;
}

/* Policy Tabs Nav */
.policy-nav-bar {
  background-color: var(--surface-light);
  border-bottom: 1px solid var(--border-color);
}

.policy-nav-container {
  max-width: var(--container-max-width);
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  overflow-x: auto;
  scrollbar-width: thin;
}

.policy-tab {
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  text-decoration: none;
  transition: all 0.2s ease;
}

.policy-tab:hover {
  color: var(--text-primary);
  text-decoration: none;
}

.policy-tab.active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
  background-color: rgba(255, 149, 0, 0.05);
}

/* Main Layout */
.main-wrapper {
  max-width: var(--container-max-width);
  margin: 32px auto;
  padding: 0 20px;
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 32px;
  align-items: start;
}

/* Sidebar / Table of Contents */
.toc-sidebar {
  position: sticky;
  top: 110px;
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
  max-height: calc(100vh - 140px);
  overflow-y: auto;
}

.toc-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary-color);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.toc-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.toc-link {
  font-size: 13.5px;
  color: var(--text-secondary);
  display: block;
  padding: 6px 10px;
  border-radius: 6px;
  text-decoration: none;
  transition: all 0.15s ease;
  line-height: 1.4;
}

.toc-link:hover {
  background-color: var(--surface-light);
  color: var(--text-primary);
  text-decoration: none;
}

/* Content Area */
.content-area {
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 36px 40px;
}

.doc-header {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 24px;
  margin-bottom: 32px;
}

h1 {
  font-size: 28px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 12px;
  line-height: 1.3;
}

.doc-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  font-size: 13px;
  color: var(--text-secondary);
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  background-color: rgba(255, 149, 0, 0.15);
  color: var(--primary-color);
  border: 1px solid rgba(255, 149, 0, 0.3);
}

.notice-box {
  background-color: rgba(88, 166, 255, 0.08);
  border-left: 4px solid var(--accent-blue);
  border-radius: 0 8px 8px 0;
  padding: 16px 20px;
  margin: 24px 0;
  font-size: 14px;
}

.notice-box.warning {
  background-color: rgba(255, 149, 0, 0.08);
  border-left-color: var(--primary-color);
}

.notice-box p {
  margin: 0;
}

.notice-box p + p {
  margin-top: 8px;
}

.notice-title {
  font-weight: 700;
  margin-bottom: 4px;
  color: #ffffff;
}

/* Sections */
.policy-section {
  margin-bottom: 36px;
  scroll-margin-top: 130px;
}

h2 {
  font-size: 20px;
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(48, 54, 61, 0.5);
  padding-bottom: 8px;
}

.section-num {
  font-size: 14px;
  font-weight: 700;
  background-color: var(--surface-light);
  color: var(--primary-color);
  padding: 2px 8px;
  border-radius: 6px;
}

h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 20px 0 10px 0;
}

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

ul, ol {
  margin-bottom: 16px;
  padding-left: 24px;
}

li {
  margin-bottom: 8px;
  color: var(--text-primary);
}

/* Tables */
.table-wrapper {
  overflow-x: auto;
  margin: 20px 0;
  border: 1px solid var(--border-color);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  text-align: left;
}

th {
  background-color: var(--surface-light);
  color: #ffffff;
  font-weight: 600;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-color);
}

td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
}

tr:last-child td {
  border-bottom: none;
}

tr:nth-child(even) td {
  background-color: rgba(255, 255, 255, 0.015);
}

.badge-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11.5px;
  font-weight: 600;
  background-color: var(--surface-light);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.badge-tag.pending {
  background-color: rgba(255, 149, 0, 0.1);
  color: var(--primary-color);
  border-color: rgba(255, 149, 0, 0.3);
}

/* Footer (Approved exact text) */
.site-footer {
  background-color: var(--surface-color);
  border-top: 1px solid var(--border-color);
  padding: 32px 20px;
  margin-top: 60px;
  text-align: center;
  font-size: 13.5px;
  line-height: 1.8;
  color: var(--text-secondary);
}

.footer-content {
  max-width: var(--container-max-width);
  margin: 0 auto;
}

.footer-line-th {
  color: var(--text-primary);
  margin-bottom: 4px;
  font-weight: 500;
}

.footer-line-en {
  color: var(--text-secondary);
  font-size: 12.5px;
  margin-bottom: 12px;
}

.footer-creator-th {
  color: var(--text-primary);
  font-weight: 600;
}

.footer-creator-en {
  color: var(--text-muted);
  font-size: 12px;
}

/* Responsive adjustments */
@media (max-width: 860px) {
  .main-wrapper {
    grid-template-columns: 1fr;
    gap: 24px;
    margin: 20px auto;
  }

  .toc-sidebar {
    position: static;
    max-height: none;
  }

  .content-area {
    padding: 24px 20px;
  }

  h1 {
    font-size: 24px;
  }
}
