@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 750;
  font-display: swap;
  src: url(/fonts/inter-v20-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 750;
  font-display: swap;
  src: url(/fonts/inter-v20-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 750;
  font-display: swap;
  src: url(/fonts/inter-v20-vietnamese.woff2) format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

/* Shared color contract. Page styles own layout and component selectors. */
:root {
  color-scheme: light;
  --goai-bg: #f7f9fc;
  --goai-surface: #ffffff;
  --goai-surface-2: #f0f4f9;
  --goai-sidebar: #edf2f8;
  --goai-text: #182333;
  --goai-muted: #566579;
  --goai-border: #dce4ee;
  --goai-accent: #2d5da9;
  --goai-accent-soft: #e9f0fc;
  --goai-accent-contrast: #ffffff;
  --goai-success: #16704b;
  --goai-success-soft: #e7f5ed;
  --goai-warning: #895714;
  --goai-warning-soft: #fff3db;
  --goai-danger: #b12e39;
  --goai-danger-soft: #fcebef;
  --goai-shadow: 0 16px 48px #1a243314;
  --goai-focus: #6494f5;
  --goai-radius: 12px;
  --goai-shadow-soft: 0 1px 3px #1a243306, 0 6px 20px #1a243306;
  --goai-shadow-raised: 0 2px 8px #1a243308, 0 16px 40px #1a243314;
  --goai-ease: cubic-bezier(.22, .68, .12, 1);
  --goai-duration: 180ms;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --goai-bg: #11161e;
  --goai-surface: #1a222d;
  --goai-surface-2: #222c39;
  --goai-sidebar: #151c26;
  --goai-text: #edf2f9;
  --goai-muted: #adb9c9;
  --goai-border: #334050;
  --goai-accent: #a3bdff;
  --goai-accent-soft: #27374f;
  --goai-accent-contrast: #14254a;
  --goai-success: #80d3ac;
  --goai-success-soft: #153b30;
  --goai-warning: #edc17d;
  --goai-warning-soft: #3d301b;
  --goai-danger: #ffa4ac;
  --goai-danger-soft: #46262e;
  --goai-shadow: 0 20px 60px #00000030;
  --goai-focus: #a5c4ff;
  --goai-shadow-soft: 0 2px 8px #00000015, 0 8px 24px #0000001f;
  --goai-shadow-raised: 0 4px 12px #0000001a, 0 24px 64px #00000038;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --goai-bg: #11161e;
    --goai-surface: #1a222d;
    --goai-surface-2: #222c39;
    --goai-sidebar: #151c26;
    --goai-text: #edf2f9;
    --goai-muted: #adb9c9;
    --goai-border: #334050;
    --goai-accent: #a3bdff;
    --goai-accent-soft: #27374f;
    --goai-accent-contrast: #14254a;
    --goai-success: #80d3ac;
    --goai-success-soft: #153b30;
    --goai-warning: #edc17d;
    --goai-warning-soft: #3d301b;
    --goai-danger: #ffa4ac;
    --goai-danger-soft: #46262e;
    --goai-shadow: 0 20px 60px #00000030;
    --goai-focus: #a5c4ff;
    --goai-shadow-soft: 0 2px 8px #00000015, 0 8px 24px #0000001f;
    --goai-shadow-raised: 0 4px 12px #0000001a, 0 24px 64px #00000038;
  }
}
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 40px;
  min-height: 40px;
  padding: 8px 11px;
  border: 1px solid var(--goai-border);
  border-radius: 10px;
  background: var(--goai-surface);
  color: var(--goai-text);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
}
.theme-toggle:hover { background: var(--goai-surface-2); }
.theme-toggle { transition: background var(--goai-duration), border-color var(--goai-duration), box-shadow var(--goai-duration); }
.theme-toggle:focus-visible { outline: 3px solid var(--goai-focus); outline-offset: 3px; }
.theme-symbol { display: inline-grid; place-items: center; width: 18px; height: 18px; }
.theme-symbol::before { content: "☀"; font-size: 19px; line-height: 1; }
:root[data-theme="dark"] .theme-symbol::before { content: "☾"; font-size: 22px; }

@keyframes goai-enter {
  from { opacity: .35; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes goai-pop {
  from { opacity: .4; transform: translateY(5px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* ---- Dễ đọc: chữ lớn và tương phản cao (do theme.js bật bằng data-text / data-contrast) ---- */
:root[data-text="large"] { zoom: 1.15; }
:root[data-text="xlarge"] { zoom: 1.3; }
@media (max-width: 620px) {
  :root[data-text="large"] { zoom: 1.08; }
  :root[data-text="xlarge"] { zoom: 1.16; }
}
:root[data-contrast="more"] {
  --goai-bg: #ffffff;
  --goai-surface: #ffffff;
  --goai-surface-2: #eef1f5;
  --goai-sidebar: #f3f5f8;
  --goai-text: #000000;
  --goai-muted: #1f2937;
  --goai-border: #4b5563;
  --goai-accent: #0b3a8c;
  --goai-accent-soft: #dbe7ff;
  --goai-accent-contrast: #ffffff;
  --goai-success: #0b5a38;
  --goai-warning: #6b3f00;
  --goai-danger: #8f1420;
  --goai-focus: #0b3a8c;
}
:root[data-theme="dark"][data-contrast="more"] {
  --goai-bg: #000000;
  --goai-surface: #0b0f14;
  --goai-surface-2: #161c24;
  --goai-sidebar: #05080c;
  --goai-text: #ffffff;
  --goai-muted: #e5e9f0;
  --goai-border: #a3afc0;
  --goai-accent: #bcd0ff;
  --goai-accent-soft: #1d2f55;
  --goai-accent-contrast: #000000;
  --goai-success: #8ff0bf;
  --goai-warning: #ffd88a;
  --goai-danger: #ffb3ba;
  --goai-focus: #ffe066;
}
:root[data-contrast="more"] body { color: var(--goai-text); }
:root[data-contrast="more"] a:not([class]) { text-decoration: underline; text-underline-offset: 3px; }
:root[data-contrast="more"] :focus-visible { outline: 3px solid var(--goai-focus); outline-offset: 2px; }
:root[data-contrast="more"] input,
:root[data-contrast="more"] textarea,
:root[data-contrast="more"] select { border: 2px solid var(--goai-border); color: var(--goai-text); }
:root[data-contrast="more"] button:not(.icon-button):not(.theme-toggle),
:root[data-contrast="more"] .outline-button { border-width: 2px; }
:root[data-contrast="more"] * { text-shadow: none; }
:root[data-contrast="more"] ::placeholder { color: var(--goai-muted); opacity: 1; }

.a11y-open { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.a11y-open-mark { font-weight: 750; font-size: 14px; line-height: 1; letter-spacing: -.3px; }
.topbar .a11y-open-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.a11y-panel {
  position: fixed; z-index: 2000; box-sizing: border-box; padding: 18px;
  background: var(--goai-surface); color: var(--goai-text); border: 1px solid var(--goai-border);
  border-radius: 14px; box-shadow: var(--goai-shadow); font: 14px/1.5 Inter, -apple-system, "Segoe UI", sans-serif;
}
.a11y-panel[hidden] { display: none; }
.a11y-title { display: block; font-size: 16px; margin-bottom: 4px; }
.a11y-note { margin: 0 0 14px; color: var(--goai-muted); font-size: 13px; }
.a11y-sizes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.a11y-size, .a11y-contrast, .a11y-reset {
  font: inherit; color: var(--goai-text); background: var(--goai-surface-2); border: 1px solid var(--goai-border);
  border-radius: 10px; cursor: pointer; min-height: 44px;
}
.a11y-size { display: grid; gap: 2px; padding: 8px 4px; justify-items: center; }
.a11y-size-mark { font-weight: 750; font-size: 18px; }
.a11y-size-label { font-size: 12px; color: var(--goai-muted); }
.a11y-size[aria-pressed="true"] { border: 2px solid var(--goai-accent); background: var(--goai-accent-soft); }
.a11y-size[aria-pressed="true"] .a11y-size-label { color: var(--goai-text); font-weight: 650; }
.a11y-contrast { display: flex; width: 100%; align-items: center; gap: 12px; padding: 8px 12px; text-align: left; font-weight: 600; }
.a11y-switch { position: relative; flex: none; width: 40px; height: 22px; border-radius: 11px; background: var(--goai-border); transition: background var(--goai-duration); }
.a11y-switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--goai-surface); transition: transform var(--goai-duration); }
.a11y-contrast[aria-pressed="true"] .a11y-switch { background: var(--goai-accent); }
.a11y-contrast[aria-pressed="true"] .a11y-switch::after { transform: translateX(18px); background: var(--goai-accent-contrast); }
.a11y-reset { display: block; width: 100%; margin-top: 10px; background: transparent; color: var(--goai-muted); font-size: 13px; }
@media (prefers-reduced-motion: reduce) { .a11y-switch, .a11y-switch::after { transition: none; } }
:root[data-contrast="more"] { --ink: #000000; --muted: #1f2937; --navy: #0b2a5c; --line: #4b5563; --blue: #0b3a8c; }
:root[data-theme="dark"][data-contrast="more"] { --ink: #ffffff; --muted: #e5e9f0; --navy: #bcd0ff; --line: #a3afc0; --blue: #bcd0ff; }

/* Bù trừ phóng đại: các khối cao bằng khung nhìn phải chia cho hệ số zoom để không tràn màn hình. */
:root { --goai-zoom: 1; }
:root[data-text="large"] { --goai-zoom: 1.15; }
:root[data-text="xlarge"] { --goai-zoom: 1.3; }
@media (max-width: 620px) {
  :root[data-text="large"] { --goai-zoom: 1.08; }
  :root[data-text="xlarge"] { --goai-zoom: 1.16; }
}
:root[data-text] .app-shell { height: calc(100dvh / var(--goai-zoom)); min-height: 0; }
:root[data-text] .entry-gate { min-height: calc(100dvh / var(--goai-zoom)); }
:root[data-text] .entry-layout { min-height: calc((100dvh - 220px) / var(--goai-zoom)); }
:root[data-text] .app-dialog.entry-auth { width: calc(100vw / var(--goai-zoom)); height: calc(100dvh / var(--goai-zoom)); }
:root[data-text] .entry-auth .auth-page-layout { min-height: calc(100dvh / var(--goai-zoom)); }
:root[data-text] .management-dialog,
:root[data-text] .google-approval-dialog { max-height: calc((100dvh - 32px) / var(--goai-zoom)); }
:root[data-text] dialog:not(.entry-auth) { max-height: calc((100dvh - 40px) / var(--goai-zoom)); }
:root[data-text] .admin-shell,
:root[data-text] .access-gate { min-height: calc(100dvh / var(--goai-zoom)); }
:root[data-text] .admin-sidebar { height: calc(100dvh / var(--goai-zoom)); }
:root[data-text] body { min-height: calc(100svh / var(--goai-zoom)); }
