:root {
  --ink: #172033;
  --muted: #657084;
  --paper: #ffffff;
  --page-tint: #f5f1ff;
  --page-tint-deep: #e8e3ff;
  --line: #e4e7ee;
  --accent: #4220b7;
  --accent-deep: #25106f;
  --accent-soft: #f0ecff;
  --danger: #d72c58;
  --danger-soft: #fff0f1;
  --radius: 18px;
  --shadow: 0 14px 34px rgba(37, 16, 111, 0.12);
}

* { box-sizing: border-box; }
html { background: var(--page-tint); color: var(--ink); scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Aptos", "Segoe UI", "Noto Sans Thai", sans-serif;
  font-size: 16px;
  line-height: 1.7;
  text-rendering: optimizeLegibility;
}
a { color: inherit; }
a:focus-visible, button:focus-visible { outline: 3px solid #f044a5; outline-offset: 3px; }
button { font: inherit; }
.skip-link { position: absolute; left: 12px; top: -100px; z-index: 10; padding: 10px 14px; border-radius: 10px; background: var(--ink); color: #fff; }
.skip-link:focus { top: 12px; }

.legal-layout { min-height: 100vh; display: grid; grid-template-columns: 276px minmax(0, 1fr); }
.legal-sidebar { position: sticky; top: 0; align-self: start; height: 100vh; padding: 31px 24px 26px; background: var(--paper); border-right: 1px solid rgba(23, 32, 51, 0.07); }
.brand { display: flex; align-items: center; gap: 11px; padding-bottom: 25px; border-bottom: 1px solid var(--line); text-decoration: none; }
.brand-mark { width: 43px; height: 43px; flex: 0 0 43px; border-radius: 12px; }
.brand-name { margin: 0; color: var(--accent); font-size: 24px; font-weight: 800; letter-spacing: -0.045em; line-height: 1; }
.brand-byline { margin: 5px 0 0; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: 0.04em; }
.home-nav { margin-top: 17px; }
.home-nav a { display: flex; min-height: 44px; align-items: center; padding: 9px 15px; border-radius: 6px; background: var(--accent-soft); color: var(--accent-deep); font-size: 14px; font-weight: 750; text-decoration: none; }
.home-nav a:hover, .home-nav a:focus-visible { background: var(--page-tint-deep); }
.sidebar-group { margin-top: 32px; }
.sidebar-heading { margin: 0 0 11px; color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: 0.02em; text-transform: uppercase; }
.sidebar-heading[lang="th"] { text-transform: none; letter-spacing: 0; }
.sidebar-nav { display: grid; gap: 4px; }
.sidebar-nav a { display: block; padding: 11px 15px; border-radius: 6px; color: var(--muted); font-size: 14px; font-weight: 650; line-height: 1.35; text-decoration: none; }
.sidebar-nav a:hover, .sidebar-nav a:focus-visible, .sidebar-nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-deep); }
.sidebar-nav .danger-nav { color: var(--danger); }
.sidebar-nav .danger-nav:hover, .sidebar-nav .danger-nav:focus-visible, .sidebar-nav .danger-nav[aria-current="page"] { background: var(--danger-soft); color: #94323a; }
.sidebar-foot { position: absolute; bottom: 25px; left: 24px; right: 24px; color: var(--muted); font-size: 13px; }
.sidebar-foot a { color: var(--muted); text-decoration: none; }
.sidebar-foot a:hover { color: var(--accent-deep); text-decoration: underline; }

.legal-main { min-width: 0; padding: 32px; background: linear-gradient(135deg, var(--page-tint), var(--page-tint-deep)); }
.legal-document { width: min(100%, 912px); min-height: calc(100vh - 64px); margin: 0 auto; padding: 61px 48px 44px; border-radius: var(--radius); background: var(--paper); box-shadow: var(--shadow); }
h1, h2, h3 { color: var(--ink); font-family: "Aptos Display", "Aptos", "Segoe UI", "Noto Sans Thai", sans-serif; letter-spacing: -0.035em; }
h1 { margin: 0; color: var(--accent); font-size: clamp(32px, 5vw, 44px); line-height: 1.16; }
h2 { margin: 37px 0 13px; font-size: 24px; line-height: 1.28; }
h3 { margin: 25px 0 7px; font-size: 19px; line-height: 1.3; }
p { margin: 0 0 15px; }
ul { margin: 0 0 16px; padding-left: 1.35em; }
li + li { margin-top: 6px; }
.meta { margin: 12px 0 35px; color: var(--muted); font-size: 14px; }
.legal-section { padding: 0 0 30px; }
.legal-section + .legal-section { padding-top: 42px; border-top: 1px solid var(--line); }
.legal-section > .eyebrow { margin: 0 0 6px; color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; }
.legal-section > .eyebrow[lang="th"] { text-transform: none; letter-spacing: 0; }
.legal-section > h2 { margin-top: 0; color: var(--accent); font-size: 32px; }
.callout { margin: 23px 0; padding: 17px 19px; border-left: 4px solid var(--accent); border-radius: 0 12px 12px 0; background: var(--accent-soft); }
.callout strong { display: block; margin-bottom: 3px; }
.danger-callout { border-left-color: var(--danger); background: var(--danger-soft); }
.footer-note { margin: 24px 0 0; padding-top: 22px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.footer-note a { color: var(--accent-deep); }

.deletion-document { max-width: 760px; }
.deletion-document h1 { margin-bottom: 7px; }
.deletion-kicker { margin: 0 0 27px; color: var(--muted); font-size: 14px; }
.deletion-summary { margin: 22px 0; padding: 18px 19px; border-radius: 12px; background: #fafbfd; }
.deletion-summary strong { display: block; margin-bottom: 7px; }
.deletion-summary ul + strong { margin-top: 17px; }
.status { margin: 20px 0; padding: 14px 15px; border-radius: 10px; background: #f4f6f9; color: var(--muted); }
.status[data-state="error"] { background: var(--danger-soft); color: #812f36; }
.status[data-state="success"] { background: #eaf8ef; color: #215d36; }
.action-stack { display: grid; gap: 11px; margin-top: 23px; }
.action-button { display: flex; align-items: center; justify-content: center; min-height: 50px; width: 100%; padding: 12px 17px; border: 0; border-radius: 8px; background: var(--accent); color: #fff; font-weight: 800; text-decoration: none; cursor: pointer; }
.action-button:hover:not(:disabled) { background: var(--accent-deep); }
.action-button:disabled { cursor: not-allowed; opacity: 0.55; }
.secondary-button { border: 1px solid var(--line); background: #fff; color: var(--ink); }
.secondary-button:hover:not(:disabled) { background: #fafbfd; }
.delete-button { background: var(--danger); }
.delete-button:hover:not(:disabled) { background: #96303a; }
.small-print { margin-top: 19px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.small-print a { color: var(--accent-deep); }
.hidden { display: none !important; }
.deletion-consent { display: flex; align-items: flex-start; gap: 12px; min-height: 48px; overflow-wrap: anywhere; }
.deletion-consent input { flex: 0 0 auto; width: 22px; height: 22px; margin-top: 3px; }
.status[data-state="ready"] { background: #eef7ff; color: #174f78; }
.status[data-state="processing"] { background: #fff7df; color: #71520b; }
.status[data-state="not_found"] { background: #f4f6f9; color: #4f5968; }

@media (max-width: 760px) {
  .legal-layout { display: block; }
  .legal-sidebar { position: static; height: auto; padding: 22px 20px 17px; border-right: 0; border-bottom: 1px solid rgba(23, 32, 51, 0.07); }
  .brand { padding-bottom: 16px; }
  .sidebar-group { margin-top: 17px; }
  .sidebar-group + .sidebar-group { margin-top: 18px; }
  .sidebar-nav { display: flex; flex-wrap: wrap; gap: 5px; }
  .sidebar-nav a { min-height: 44px; display: inline-flex; align-items: center; padding: 7px 10px; font-size: 13px; }
  .sidebar-foot { position: static; margin-top: 17px; }
  .legal-main { padding: 16px; }
  .legal-document { min-height: auto; padding: 34px 24px 28px; border-radius: 14px; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
