:root {
  color-scheme: light dark;
  --bg: #f7fbfc;
  --bg-soft: #eef9fb;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-solid: #ffffff;
  --surface-raised: #ffffff;
  --text: #0f172a;
  --muted: #5f6f7f;
  --border: rgba(8, 145, 178, 0.22);
  --border-strong: rgba(6, 182, 212, 0.58);
  --cyan: #06b6d4;
  --cyan-dark: #0e7490;
  --cyan-soft: rgba(6, 182, 212, 0.11);
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, 0.1);
  --success: #059669;
  --warning: #d97706;
  --shadow: 0 18px 55px rgba(15, 23, 42, 0.09);
  --shadow-soft: 0 10px 30px rgba(15, 23, 42, 0.07);
  --radius-sm: 12px;
  --radius: 18px;
  --radius-lg: 28px;
  --container: 1180px;
  --header-h: 72px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #04070d;
  --bg-soft: #07111f;
  --surface: rgba(8, 18, 32, 0.88);
  --surface-solid: #081220;
  --surface-raised: #0b1727;
  --text: #eafcff;
  --muted: #96a9b5;
  --border: rgba(34, 211, 238, 0.2);
  --border-strong: rgba(34, 211, 238, 0.62);
  --cyan: #22d3ee;
  --cyan-dark: #67e8f9;
  --cyan-soft: rgba(34, 211, 238, 0.1);
  --danger: #fb7185;
  --danger-soft: rgba(251, 113, 133, 0.12);
  --success: #34d399;
  --warning: #fbbf24;
  --shadow: 0 22px 65px rgba(0, 0, 0, 0.38);
  --shadow-soft: 0 12px 32px rgba(0, 0, 0, 0.28);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]),
  :root[data-theme="auto"] {
    color-scheme: dark;
    --bg: #04070d;
    --bg-soft: #07111f;
    --surface: rgba(8, 18, 32, 0.88);
    --surface-solid: #081220;
    --surface-raised: #0b1727;
    --text: #eafcff;
    --muted: #96a9b5;
    --border: rgba(34, 211, 238, 0.2);
    --border-strong: rgba(34, 211, 238, 0.62);
    --cyan: #22d3ee;
    --cyan-dark: #67e8f9;
    --cyan-soft: rgba(34, 211, 238, 0.1);
    --danger: #fb7185;
    --danger-soft: rgba(251, 113, 133, 0.12);
    --success: #34d399;
    --warning: #fbbf24;
    --shadow: 0 22px 65px rgba(0, 0, 0, 0.38);
    --shadow-soft: 0 12px 32px rgba(0, 0, 0, 0.28);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { min-height: 100%; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--text);
  background:
    radial-gradient(900px 500px at 10% -5%, var(--cyan-soft), transparent 65%),
    radial-gradient(700px 460px at 92% 10%, var(--cyan-soft), transparent 70%),
    var(--bg);
  font-size: clamp(14px, 0.25vw + 13px, 16px);
  line-height: 1.6;
  transition: background-color 0.2s ease, color 0.2s ease;
}
body.sidebar-modal-open { overflow: hidden; }
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.16;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: linear-gradient(to bottom, black, transparent 78%);
}
button, input, select, textarea { font: inherit; color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.58; }
::selection { background: rgba(34, 211, 238, 0.28); }
:focus-visible { outline: 3px solid rgba(34, 211, 238, 0.42); outline-offset: 2px; }

.container { width: min(calc(100% - 32px), var(--container)); margin-inline: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.text-center { text-align: center; }
.stack { display: grid; gap: 16px; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }

.site-header {
  min-height: var(--header-h);
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  backdrop-filter: blur(18px);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.brand { display: inline-flex; align-items: center; gap: 11px; min-width: 0; }
.brand-logo { width: 44px; height: 44px; flex: 0 0 auto; filter: drop-shadow(0 0 14px rgba(34, 211, 238, 0.22)); }
.brand-copy { display: grid; line-height: 1.15; }
.brand-name { font-size: 0.98rem; font-weight: 900; letter-spacing: 0.08em; }
.brand-tagline { margin-top: 4px; color: var(--muted); font-size: 0.72rem; }
.header-actions { display: flex; align-items: center; justify-content: flex-end; gap: 9px; }
.header-nav { display: flex; align-items: center; gap: 22px; margin-left: auto; }
.header-nav a { color: var(--muted); font-weight: 700; font-size: 0.9rem; }
.header-nav a:hover { color: var(--cyan-dark); }

.icon-btn {
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  border-radius: 13px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}
.icon-btn:hover { border-color: var(--border-strong); transform: translateY(-1px); }

.btn {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 10px 17px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  font-weight: 800;
  line-height: 1.15;
  box-shadow: var(--shadow-soft);
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}
.btn:hover { transform: translateY(-1px); border-color: var(--border-strong); }
.btn-primary {
  border-color: transparent;
  color: #03212a;
  background: linear-gradient(135deg, #67e8f9, #06b6d4);
  box-shadow: 0 12px 30px rgba(6, 182, 212, 0.25);
}
.btn-primary:hover { box-shadow: 0 16px 36px rgba(6, 182, 212, 0.32); }
.btn-danger { border-color: color-mix(in srgb, var(--danger) 38%, transparent); color: var(--danger); background: var(--danger-soft); }
.btn-ghost { box-shadow: none; background: transparent; }
.btn-small { min-height: 38px; padding: 8px 13px; border-radius: 12px; font-size: 0.88rem; }
.btn-block { width: 100%; }

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}
.card-pad { padding: clamp(20px, 3vw, 32px); }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; color: var(--cyan-dark); font-weight: 900; text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.74rem; }
.eyebrow::before { content: ""; width: 22px; height: 2px; border-radius: 99px; background: var(--cyan); }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { line-height: 1.16; letter-spacing: -0.025em; }

.form-group { display: grid; gap: 7px; }
.form-label { font-size: 0.88rem; font-weight: 800; }
.form-hint { color: var(--muted); font-size: 0.78rem; line-height: 1.45; }
.input-wrap { position: relative; }
.input {
  width: 100%;
  min-height: 48px;
  padding: 11px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface-solid) 88%, transparent);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.input::placeholder { color: color-mix(in srgb, var(--muted) 78%, transparent); }
.input:focus { border-color: var(--border-strong); box-shadow: 0 0 0 4px var(--cyan-soft); }
.input.has-action { padding-right: 52px; }
.input-action { position: absolute; top: 50%; right: 7px; transform: translateY(-50%); width: 38px; height: 38px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); }
.input-action:hover { background: var(--cyan-soft); color: var(--cyan-dark); }
.checkbox-row { display: flex; align-items: flex-start; gap: 10px; color: var(--muted); font-size: 0.88rem; }
.checkbox-row input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--cyan); flex: 0 0 auto; }
.text-link { color: var(--cyan-dark); font-weight: 800; }
.text-link:hover { text-decoration: underline; }

.captcha-box { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.captcha-image { width: 100%; height: 70px; object-fit: cover; border-radius: 14px; border: 1px solid var(--border-strong); background: #07111f; }
.captcha-refresh { width: 46px; height: 46px; border-radius: 13px; border: 1px solid var(--border); background: var(--surface); font-size: 1.15rem; }

.status-note { padding: 13px 15px; border: 1px solid var(--border); border-radius: 14px; background: var(--cyan-soft); color: var(--muted); font-size: 0.86rem; }
.step-badge { display: inline-grid; place-items: center; min-width: 32px; height: 32px; padding: 0 10px; border-radius: 999px; background: var(--cyan-soft); color: var(--cyan-dark); font-weight: 900; font-size: 0.78rem; }

.modal-layer { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 20px; background: rgba(2, 8, 18, 0.66); backdrop-filter: blur(8px); }
.modal {
  width: min(100%, 430px);
  padding: 26px;
  border: 1px solid var(--border-strong);
  border-radius: 22px;
  background: var(--surface-solid);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.38);
  animation: modal-in 0.18s ease-out;
}
.modal-icon { width: 50px; height: 50px; display: grid; place-items: center; border-radius: 16px; background: var(--cyan-soft); color: var(--cyan-dark); font-size: 1.35rem; font-weight: 900; }
.modal h2 { margin: 16px 0 8px; font-size: 1.25rem; }
.modal p { margin-bottom: 20px; color: var(--muted); white-space: pre-line; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }

.loading-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; animation: pulse 0.8s ease-in-out infinite alternate; }
@keyframes pulse { to { opacity: 0.25; transform: scale(0.75); } }

.site-footer { border-top: 1px solid var(--border); padding: 26px 0; color: var(--muted); font-size: 0.85rem; }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

@media (max-width: 820px) {
  :root { --header-h: 64px; }
  .container { width: min(calc(100% - 22px), var(--container)); }
  .header-nav { display: none; }
  .brand-tagline { display: none; }
  .header-actions .desktop-only { display: none; }
  .btn { padding-inline: 14px; }
}

@media (max-width: 480px) {
  .brand-logo { width: 38px; height: 38px; }
  .brand-name { font-size: 0.85rem; }
  .site-header .btn-small { min-height: 40px; padding-inline: 11px; }
  .modal { padding: 21px; }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

.policy-main { padding: 48px 0 78px; max-width: 900px; }
.not-found-main { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.not-found-card { max-width: 540px; }

/* STEP 6.3: phản hồi tức thời khi người dùng chuyển sang trang khác. */
body.page-navigating { cursor: progress; }
body.page-navigating::before {
  content: "";
  position: fixed;
  z-index: 99999;
  top: 0;
  left: 0;
  width: 42%;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--primary, #06b6d4), #67e8f9);
  box-shadow: 0 0 16px rgba(34, 211, 238, .9);
  animation: legi-page-progress .75s ease-in-out infinite;
  pointer-events: none;
}
@keyframes legi-page-progress {
  from { transform: translateX(-110%); }
  to { transform: translateX(340%); }
}
@media (prefers-reduced-motion: reduce) {
  body.page-navigating::before { animation-duration: 1.6s; }
}

/* STEP 9.1 — every long popup remains reachable and scrollable */
.modal-layer{overflow-y:auto;overscroll-behavior:contain;align-items:center;scrollbar-gutter:stable}
.modal{max-height:calc(100dvh - 40px);overflow-y:auto;overscroll-behavior:contain;scrollbar-gutter:stable;padding-bottom:max(22px,env(safe-area-inset-bottom))}
.step5-form-modal{display:flex;flex-direction:column;max-height:calc(100dvh - 32px);overflow:hidden}
.step5-form-modal>h2{flex:0 0 auto;margin-top:0}
.step5-form-fields{min-height:0;overflow-y:auto;overscroll-behavior:contain;scrollbar-gutter:stable;padding:2px 5px 4px 1px;margin-bottom:0}
.step5-form-fields>.modal-actions{position:sticky;bottom:-4px;z-index:2;margin:6px -5px -4px;padding:12px 5px 4px;background:linear-gradient(180deg,transparent,var(--surface-solid) 28%)}
body:has(.modal-layer){overflow:hidden}
@media(max-height:680px),(max-width:520px){.modal-layer{place-items:start center;padding:12px}.modal{width:100%;max-height:calc(100dvh - 24px);border-radius:18px}.step5-form-modal{max-height:calc(100dvh - 24px)}}

/* =========================================================
   STEP 10 — GLOBAL UI CONSISTENCY / OVERFLOW HARDENING
   Applied to every page through styles.css so legacy pages,
   Founder pages and new pages share the same safe behavior.
   ========================================================= */
html,body{max-width:100%;overflow-x:hidden}.dashboard-shell,.dashboard-main,.dashboard-content,.card,.stack,.row,.row-between{min-width:0}.card{max-width:100%}.modal-layer{overflow-y:auto;overscroll-behavior:contain;align-items:safe center}.modal{max-width:100%;max-height:calc(100dvh - 40px);overflow:auto;overscroll-behavior:contain}.modal-actions{position:sticky;bottom:-26px;margin:16px -26px -26px;padding:14px 26px 26px;background:linear-gradient(to top,var(--surface-solid) 78%,transparent);z-index:2}.legacy-popup-modal,.page-access-modal{max-height:calc(100dvh - 40px);overflow:auto}.input,select,textarea,button{max-width:100%}textarea.input{resize:vertical}.table-wrap,.step5-table-wrap,.page-access-table-wrap,.ff-table-wrap{max-width:100%;overflow:auto;overscroll-behavior-x:contain}pre,.api-code,code{max-width:100%;overflow-wrap:anywhere}.row>*{min-width:0}.row-between>*{min-width:0}.service-grid>*{min-width:0}.founder-nav{max-width:100%;overflow-x:auto;overscroll-behavior-x:contain;scrollbar-width:thin}.founder-nav>.btn{flex:0 0 auto}.image-modal img{max-height:min(70dvh,900px);object-fit:contain}@media(max-width:560px){.modal-layer{padding:10px}.modal{padding:20px;border-radius:18px;max-height:calc(100dvh - 20px)}.modal-actions{bottom:-20px;margin:14px -20px -20px;padding:12px 20px 20px}.row-between{align-items:flex-start}.row-between>.btn,.row-between>.btn-primary{flex:0 0 auto}}
