:root {
  color-scheme: light;
  --bg: #f3f7fb;
  --surface: #ffffff;
  --surface-soft: #edf4fb;
  --text: #101b2d;
  --muted: #5d6b80;
  --line: #d8e2ee;
  --navy: #061326;
  --gold: #ffc319;
  --gold-ink: #735200;
  --blue: #1769d2;
  --green: #168a4f;
  --coral: #d94b59;
  font-family: "Noto Sans Thai", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { min-width: 320px; margin: 0; background: var(--bg); color: var(--text); line-height: 1.75; letter-spacing: 0; }
button, a { font: inherit; }
a { color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

body.dark-mode {
  color-scheme: dark;
  --bg: #061326;
  --surface: #0d1b2f;
  --surface-soft: #13243a;
  --text: #f4f7fb;
  --muted: #b4c0d0;
  --line: #2b3e57;
  --gold-ink: #ffd34a;
  --blue: #80b6ff;
  --green: #72d99a;
  --coral: #ff8b96;
}

.content-header {
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid rgba(255,255,255,.13);
  background: rgba(6, 19, 38, .97);
  color: #fff;
}

.content-header-inner {
  width: min(100% - 32px, 1180px);
  min-height: 66px;
  display: flex;
  align-items: center;
  gap: 24px;
  margin: auto;
}

.content-brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: #fff;
  text-decoration: none;
  font-size: 23px;
  font-weight: 800;
  white-space: nowrap;
}

.content-brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 2px solid var(--gold);
  border-radius: 50%;
  color: var(--gold);
  font-size: 19px;
}

.content-nav { display: flex; align-items: center; gap: 20px; margin-left: auto; }
.content-nav a { color: #dbe5f2; text-decoration: none; font-size: 13px; font-weight: 700; }
.content-nav a:hover, .content-nav a.active { color: var(--gold); }

.theme-control {
  width: 39px;
  height: 39px;
  border: 1px solid rgba(255,255,255,.3);
  border-radius: 6px;
  background: transparent;
  color: #fff;
  font-size: 18px;
}

.content-menu-toggle{display:none;width:44px;height:44px;align-items:center;justify-content:center;flex-direction:column;gap:5px;border:1px solid rgba(255,255,255,.3);border-radius:7px;background:transparent;color:#fff}
.content-menu-toggle span{width:20px;height:2px;border-radius:2px;background:currentColor}
.contact-mobile-nav{position:absolute;top:calc(100% + 8px);right:12px;width:min(250px,calc(100vw - 24px));padding:7px;border:1px solid #314861;border-radius:8px;background:#09182b;box-shadow:0 18px 42px rgba(0,0,0,.34)}
.contact-mobile-nav a{display:block;min-height:42px;padding:9px 11px;border-radius:6px;color:#e4edf8;text-decoration:none;font-size:13px;font-weight:800}
.contact-mobile-nav a:hover,.contact-mobile-nav a:focus-visible,.contact-mobile-nav a.active{background:#142a45;color:var(--gold);outline:0}

.doc-hero {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.doc-hero-inner {
  width: min(100% - 32px, 1040px);
  padding: 48px 0 42px;
  margin: auto;
}

.doc-eyebrow { margin: 0 0 5px; color: var(--gold-ink); font-size: 13px; font-weight: 800; }
.doc-hero h1 { max-width: 780px; margin: 0; font-size: clamp(31px, 4vw, 47px); line-height: 1.22; font-weight: 800; }
.doc-summary { max-width: 780px; margin: 12px 0 0; color: var(--muted); font-size: 16px; }

.doc-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 24px;
}

.doc-updated { color: var(--muted); font-size: 12px; }
.language-control { display: inline-grid; grid-template-columns: 1fr 1fr; padding: 3px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-soft); }
.language-control button { min-width: 82px; min-height: 35px; border: 0; border-radius: 5px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 800; }
.language-control button[aria-pressed="true"] { background: var(--navy); color: #fff; }
body.dark-mode .language-control button[aria-pressed="true"] { background: var(--gold); color: #171100; }

.document-shell { width: min(100% - 32px, 1040px); margin: 0 auto 70px; }
.doc-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 54px; align-items: start; }
.doc-toc { position: sticky; top: 88px; padding-top: 32px; }
.doc-toc strong { display: block; margin-bottom: 10px; color: var(--text); font-size: 12px; }
.doc-toc a { display: block; padding: 7px 0; border-left: 2px solid var(--line); color: var(--muted); text-decoration: none; font-size: 12px; line-height: 1.45; padding-left: 12px; }
.doc-toc a:hover { border-left-color: var(--gold); color: var(--text); }

.doc-body { min-width: 0; background: var(--surface); }
.doc-section { scroll-margin-top: 88px; padding: 34px 0; border-bottom: 1px solid var(--line); }
.doc-section:last-child { border-bottom: 0; }
.doc-section h2 { display: flex; align-items: center; gap: 11px; margin: 0 0 12px; font-size: 22px; line-height: 1.35; font-weight: 800; }
.doc-section h2::before { content: ""; width: 4px; height: 27px; flex: 0 0 4px; border-radius: 2px; background: var(--blue); }
.doc-section h3 { margin: 24px 0 8px; font-size: 16px; font-weight: 800; }
.doc-section p { margin: 0 0 13px; color: #344157; }
.doc-section ul, .doc-section ol { padding-left: 22px; margin: 10px 0 0; }
.doc-section li { margin: 7px 0; color: #344157; }
.doc-section strong { color: var(--text); }
body.dark-mode .doc-section p, body.dark-mode .doc-section li { color: #d3deeb; }

.role-grid, .principle-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; overflow: hidden; margin-top: 18px; border: 1px solid var(--line); border-radius: 7px; background: var(--line); }
.role-column, .principle-item { padding: 18px; background: var(--surface-soft); }
.role-column.allowed { border-top: 3px solid var(--green); }
.role-column.not-allowed { border-top: 3px solid var(--coral); }
.role-column h3, .principle-item h3 { margin-top: 0; }
.principle-item p { margin-bottom: 0; font-size: 13px; }

.workflow { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.workflow span { display: inline-flex; align-items: center; gap: 8px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface-soft); color: var(--text); font-size: 12px; font-weight: 700; }
.workflow span:not(:last-child)::after { content: "›"; color: var(--blue); font-size: 18px; }

.notice {
  margin: 18px 0 0;
  padding: 16px 18px;
  border: 1px solid #ddb44a;
  border-left: 5px solid var(--gold);
  border-radius: 6px;
  background: #fff9e8;
  color: #4e3a00;
}
.notice strong { display: block; margin-bottom: 3px; }
body.dark-mode .notice { border-color: #7f681d; border-left-color: var(--gold); background: #27230f; color: #f3df9d; }

.content-footer { border-top: 1px solid var(--line); background: var(--surface); }
.content-footer-inner { width: min(100% - 32px, 1040px); display: flex; justify-content: space-between; gap: 20px; padding: 25px 0 34px; margin: auto; color: var(--muted); font-size: 12px; }
.content-footer nav { display: flex; flex-wrap: wrap; gap: 10px 18px; }
.content-footer a { color: var(--blue); font-weight: 700; text-decoration: none; }

@media (max-width: 820px) {
  .content-nav { display: none; }
  .content-header-inner { gap: 12px; }
  .theme-control { margin-left: auto; }
  body[data-document="contact"] .content-menu-toggle{display:flex}
  .doc-layout { grid-template-columns: 1fr; gap: 0; }
  .doc-toc { position: static; display: flex; flex-wrap: wrap; gap: 7px; padding: 20px 0 4px; }
  .doc-toc strong { width: 100%; margin-bottom: 0; }
  .doc-toc a { padding: 6px 9px; border: 1px solid var(--line); border-radius: 5px; }
  .doc-body { background: transparent; }
}

@media (max-width: 560px) {
  .doc-hero-inner { padding-block: 34px 30px; }
  .doc-hero h1 { font-size: 31px; }
  .doc-summary { font-size: 14px; }
  .doc-tools { align-items: flex-start; flex-direction: column-reverse; }
  .language-control { width: 100%; }
  .language-control button { width: 100%; }
  .role-grid, .principle-grid { grid-template-columns: 1fr; }
  .doc-section { padding: 28px 0; }
  .doc-section h2 { font-size: 20px; }
  .content-footer-inner { flex-direction: column; }
}

/* Document presentation */
.doc-hero {
  position: relative;
  overflow: hidden;
  background: #f8fbff;
}

body.dark-mode .doc-hero { background: #08172a; }

.doc-hero-inner {
  width: min(100% - 40px, 1180px);
  min-height: 380px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  grid-template-rows: 1fr auto;
  column-gap: 68px;
  align-items: center;
  padding: 64px 0 42px;
}

.doc-hero-inner > [data-language-copy] { grid-column: 1; align-self: end; }
.doc-hero h1 { max-width: 760px; font-size: 48px; line-height: 1.18; }
.doc-summary { max-width: 720px; font-size: 16px; line-height: 1.8; }
.doc-tools { grid-column: 1; align-self: start; margin-top: 26px; }
.doc-updated::before { content: "□"; margin-right: 7px; color: var(--blue); font-weight: 900; }

.doc-visual {
  position: relative;
  grid-column: 2;
  grid-row: 1 / 3;
  width: 300px;
  height: 250px;
  justify-self: end;
  display: grid;
  place-items: center;
  border: 1px solid #d7e5f6;
  border-radius: 8px;
  background: #eaf3ff;
  box-shadow: 0 22px 46px rgba(24, 83, 156, .14);
}

body.dark-mode .doc-visual { border-color: #2b4563; background: #102844; box-shadow: 0 22px 46px rgba(0,0,0,.24); }
.doc-visual-symbol { position: relative; width: 122px; height: 142px; display: block; color: #fff; }
.visual-chip { position: absolute; width: 46px; height: 46px; border: 7px solid #fff; border-radius: 50%; background: var(--gold); box-shadow: 0 5px 16px rgba(20,62,115,.16); }
.chip-one { right: 36px; bottom: 34px; }
.chip-two { left: 34px; top: 42px; width: 31px; height: 31px; border-width: 5px; background: #4fa2ff; }

body[data-document="privacy"] .doc-visual-symbol { width: 128px; height: 112px; margin-top: 30px; border: 8px solid #fff; border-radius: 18px; background: #1976e9; box-shadow: 0 16px 28px rgba(18,94,188,.28); }
body[data-document="privacy"] .doc-visual-symbol::before { content: ""; position: absolute; left: 27px; top: -69px; width: 58px; height: 70px; border: 8px solid #fff; border-bottom: 0; border-radius: 36px 36px 0 0; }
body[data-document="privacy"] .doc-visual-symbol::after { content: ""; position: absolute; left: 52px; top: 37px; width: 10px; height: 30px; border-radius: 5px; background: #fff; }
body[data-document="terms"] .doc-visual-symbol { width: 112px; height: 142px; border: 7px solid #fff; border-radius: 8px; background: #1976e9; box-shadow: 0 16px 28px rgba(18,94,188,.28); }
body[data-document="terms"] .doc-visual-symbol::before { content: ""; position: absolute; left: 22px; right: 22px; top: 38px; height: 7px; border-radius: 4px; background: #fff; box-shadow: 0 23px #fff, 0 46px #fff; }
body[data-document="about"] .doc-visual-symbol { width: 136px; height: 136px; border: 10px solid #fff; border-radius: 50%; background: #1976e9; box-shadow: 0 16px 28px rgba(18,94,188,.28); }
body[data-document="about"] .doc-visual-symbol::before { content: ""; position: absolute; left: 35px; top: 43px; width: 53px; height: 26px; border-left: 10px solid #fff; border-bottom: 10px solid #fff; transform: rotate(-45deg); }

.document-shell { width: min(100% - 40px, 1180px); margin: 30px auto 76px; }
.doc-layout { grid-template-columns: 260px minmax(0, 1fr); gap: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: 0 16px 42px rgba(22,47,80,.08); }
.doc-toc { top: 88px; align-self: stretch; min-height: 100%; padding: 28px 18px 36px; border-right: 1px solid var(--line); background: var(--surface-soft); }
.doc-toc strong { padding: 0 12px 12px; border-bottom: 2px solid var(--gold); font-size: 13px; }
.doc-toc a { margin-top: 3px; padding: 9px 11px; border: 0; border-radius: 6px; font-size: 12px; }
.doc-toc a:hover, .doc-toc a.active { background: #e7f1ff; color: #0d61c9; }
body.dark-mode .doc-toc a:hover, body.dark-mode .doc-toc a.active { background: #17304f; color: #8fc1ff; }
.doc-body { padding: 6px 38px 24px; }
.doc-section { padding: 32px 0; }
.doc-section h2 { font-size: 23px; }
.doc-section h2::before { width: 34px; height: 34px; flex-basis: 34px; display: inline-grid; place-items: center; border-radius: 50%; background: #e6f1ff; color: var(--blue); }
.doc-section p, .doc-section li { line-height: 1.85; }

@media (max-width: 900px) {
  .doc-hero-inner { grid-template-columns: minmax(0,1fr) 230px; column-gap: 32px; }
  .doc-visual { width: 220px; height: 205px; transform: scale(.88); transform-origin: center right; }
  .doc-layout { grid-template-columns: 220px minmax(0,1fr); }
  .doc-body { padding-inline: 28px; }
}

@media (max-width: 760px) {
  .doc-hero-inner { min-height: auto; display: block; padding-block: 38px 30px; }
  .doc-hero h1 { font-size: 34px; }
  .doc-visual { display: none; }
  .doc-tools { align-items: flex-start; flex-direction: column-reverse; }
  .doc-layout { display: block; overflow: visible; border: 0; background: transparent; box-shadow: none; }
  .doc-toc { position: static; display: flex; min-height: 0; flex-wrap: wrap; gap: 6px; padding: 15px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
  .doc-toc strong { width: 100%; padding: 0 0 9px; }
  .doc-toc a { margin: 0; padding: 6px 8px; border: 1px solid var(--line); }
  .doc-body { margin-top: 12px; padding: 0 18px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
}

@media (max-width: 480px) {
  .doc-hero-inner, .document-shell { width: calc(100% - 32px); }
  .doc-hero h1 { font-size: 30px; }
  .doc-section h2 { align-items: flex-start; font-size: 20px; }
  .doc-section h2::before { width: 28px; height: 28px; flex-basis: 28px; }
}

html,body{max-width:100%;overflow-x:hidden}body{min-width:0}.doc-section,.doc-summary,.contact-card{min-width:0;overflow-wrap:anywhere}@media(max-width:480px){.doc-hero-inner,.document-shell{width:calc(100% - 24px)}.doc-section{padding-inline:14px}.doc-header-inner{width:calc(100% - 24px)}}

/* Contact page */
.contact-page{min-height:calc(100vh - 66px);background:var(--bg)}
.contact-hero{border-bottom:1px solid var(--line);background:var(--surface)}
.contact-hero-inner{width:min(100% - 40px,1040px);min-height:330px;display:grid;grid-template-columns:minmax(0,1fr) 330px;align-items:center;gap:52px;margin:auto;padding:48px 0 40px}
.contact-hero-copy p{margin:0 0 6px;color:var(--blue);font-size:14px;font-weight:800}
.contact-hero-copy h1{margin:0;font-size:44px;line-height:1.2;text-wrap:balance}
.contact-hero-copy span{display:block;max-width:650px;margin-top:14px;color:var(--muted);font-size:17px;line-height:1.8;text-wrap:pretty}
.contact-visual{position:relative;width:300px;height:230px;display:grid;place-items:center;justify-self:end}
.contact-visual-halo{position:absolute;width:210px;height:210px;border-radius:50%;background:#e9f3ff}
.contact-envelope{position:relative;z-index:2;width:190px;height:118px;margin-top:48px;border-radius:8px;background:#76a7eb;box-shadow:0 20px 34px rgba(45,104,181,.18)}
.contact-envelope::before{content:"";position:absolute;inset:0;border-radius:8px;background:linear-gradient(145deg,transparent 49%,#5f94dc 50%) left/50% 100% no-repeat,linear-gradient(215deg,transparent 49%,#6da0e4 50%) right/50% 100% no-repeat}
.contact-envelope::after{content:"";position:absolute;left:23px;right:23px;top:-52px;height:86px;border-radius:8px 8px 0 0;background:#fff;clip-path:polygon(0 0,100% 0,100% 55%,50% 100%,0 55%)}
.contact-envelope i{position:absolute;z-index:3;left:50%;top:-31px;width:54px;height:54px;display:grid;place-items:center;border-radius:50%;background:#c8ddfb;color:#fff;font-size:31px;font-style:normal;transform:translateX(-50%)}
.contact-leaf{position:absolute;z-index:1;bottom:31px;width:62px;height:82px;border:8px solid #d5e6fb;border-top:0;border-bottom:0}
.leaf-left{left:20px;border-radius:70% 20%;transform:rotate(-23deg)}
.leaf-right{right:18px;border-radius:20% 70%;transform:rotate(23deg)}
body.dark-mode .contact-visual-halo{background:#102844}
body.dark-mode .contact-envelope::after{background:#dce9f8}
.contact-shell{width:min(100% - 40px,1040px);display:grid;gap:20px;margin:32px auto 72px}
.contact-card{display:grid;grid-template-columns:92px minmax(0,1fr);gap:24px;padding:32px;border:1px solid var(--line);border-radius:8px;background:var(--surface);box-shadow:0 16px 42px rgba(22,47,80,.08)}
.contact-channel-icon{width:76px;height:76px;display:grid;place-items:center;border-radius:50%;background:#e9f3ff;color:#1769d2}
.contact-channel-icon span{position:relative;width:37px;height:27px;border:3px solid currentColor;border-radius:5px}
.contact-channel-icon span::before,.contact-channel-icon span::after{content:"";position:absolute;top:3px;width:22px;height:3px;border-radius:2px;background:currentColor}
.contact-channel-icon span::before{left:1px;transform:rotate(34deg)}
.contact-channel-icon span::after{right:1px;transform:rotate(-34deg)}
body.dark-mode .contact-channel-icon{background:#122f50;color:#80b6ff}
.contact-card-content h2{margin:0;font-size:26px;line-height:1.35}
.contact-card-content>p{max-width:720px;margin:8px 0 20px;color:var(--muted)}
.contact-email-control{max-width:660px;min-height:70px;display:grid;grid-template-columns:minmax(0,1fr) 52px;align-items:center;overflow:hidden;border:1px solid #c8dcf4;border-radius:8px;background:#f3f8ff}
.contact-email-control a{min-width:0;padding:16px 20px;color:#1464cd;font-size:24px;font-weight:800;text-decoration:none;overflow-wrap:anywhere}
.contact-email-control button{width:44px;height:44px;display:grid;place-items:center;border:0;border-radius:6px;background:transparent;color:#4b8ce3}
.contact-email-control button:hover,.contact-email-control button:focus-visible{background:#e1edfd;outline:2px solid #7fb0ef;outline-offset:-2px}
.copy-glyph{position:relative;width:19px;height:23px;border:2px solid currentColor;border-radius:4px}
.copy-glyph::before{content:"";position:absolute;left:-7px;top:-6px;width:16px;height:20px;border:2px solid currentColor;border-radius:4px;background:inherit}
.contact-email-control button[data-copied="true"]{color:var(--green)}
.copy-status{display:block;min-height:22px;margin-top:5px;color:var(--green);font-size:12px;font-weight:800}
.contact-card-content>small{display:block;margin-top:12px;color:var(--muted);font-size:12px}
body.dark-mode .contact-email-control{border-color:#315071;background:#10243e}
body.dark-mode .contact-email-control a{color:#91c1ff}
body.dark-mode .contact-email-control button:hover,body.dark-mode .contact-email-control button:focus-visible{background:#173555}
.contact-security{display:grid;grid-template-columns:56px minmax(0,1fr);align-items:start;gap:18px;padding:24px 28px;border:1px solid #e5c66c;border-left:5px solid var(--gold);border-radius:8px;background:#fff9e9}
.security-mark{width:46px;height:52px;display:grid;place-items:center;clip-path:polygon(50% 0,92% 17%,86% 72%,50% 100%,14% 72%,8% 17%);background:var(--gold);color:#4d3800;font-size:23px;font-weight:900}
.contact-security strong{display:block;font-size:18px}
.contact-security p{margin:5px 0 0;color:#4e4429;line-height:1.8}
body.dark-mode .contact-security{border-color:#79651f;border-left-color:var(--gold);background:#28230f}
body.dark-mode .contact-security p{color:#e8daa9}

@media(max-width:760px){
  .contact-hero-inner{width:calc(100% - 24px);min-height:0;grid-template-columns:minmax(0,1fr) 150px;gap:10px;padding:32px 0 28px}
  .contact-hero-copy h1{font-size:32px}
  .contact-hero-copy span{font-size:14px}
  .contact-visual{width:150px;height:160px;transform:scale(.7);transform-origin:center}
  .contact-shell{width:calc(100% - 24px);margin:20px auto 48px}
  .contact-card{grid-template-columns:64px minmax(0,1fr);gap:14px;padding:20px 16px}
  .contact-channel-icon{width:58px;height:58px}
  .contact-card-content h2{font-size:22px}
  .contact-email-control a{padding-inline:14px;font-size:18px}
  .contact-security{grid-template-columns:44px minmax(0,1fr);gap:12px;padding:18px 16px}
  .security-mark{width:40px;height:46px}
}

@media(max-width:430px){
  .contact-hero-inner{grid-template-columns:1fr 108px}
  .contact-hero-copy h1{font-size:28px}
  .contact-visual{width:100px;height:136px;transform:none}
  .contact-visual-halo{width:104px;height:104px}
  .contact-envelope{width:94px;height:59px;margin-top:30px;border-radius:5px;box-shadow:0 12px 24px rgba(45,104,181,.16)}
  .contact-envelope::before{border-radius:5px}
  .contact-envelope::after{left:12px;right:12px;top:-27px;height:45px;border-radius:5px 5px 0 0}
  .contact-envelope i{top:-18px;width:30px;height:30px;font-size:17px}
  .contact-leaf{display:none}
  .contact-card{grid-template-columns:1fr}
  .contact-channel-icon{width:52px;height:52px}
  .contact-email-control{grid-template-columns:minmax(0,1fr) 46px}
  .contact-email-control a{font-size:16px}
  .contact-security strong{font-size:16px}
  .contact-security p{font-size:13px}
}
/* Error-page recovery actions */
.error-actions{display:flex;flex-wrap:wrap;gap:12px;margin-top:28px}.error-actions a{display:inline-flex;align-items:center;justify-content:center;min-height:44px;padding:10px 18px;border-radius:10px;background:#14263d;color:#fff;text-decoration:none;font-weight:700}.error-actions a:focus-visible{outline:3px solid #f28a2e;outline-offset:3px}@media(max-width:520px){.error-actions{display:grid}.error-actions a{width:100%}}
