/* Nền tảng giao diện SSO: màu theo sáng/tối, thanh trên cùng, nút, ô nhập, thông báo, sheet, danh ngôn. */

:root {
    color-scheme: light;
    --bg: #f4f7fb;
    --bg-wash:
        radial-gradient(70vmax 46vmax at 8% -6%, rgba(0, 113, 227, 0.15), transparent 70%),
        radial-gradient(60vmax 42vmax at 96% 0, rgba(64, 190, 215, 0.17), transparent 70%);
    --surface: #ffffff;
    --surface-2: #f5f5f7;
    --hover: rgba(0, 0, 0, 0.045);
    --bar: rgba(251, 251, 253, 0.78);
    --sheet-bg: #f5f5f7;
    --sheet-card: #ffffff;
    --field-bg: #ffffff;
    --text: #1d1d1f;
    --text-2: #68686d;
    --line: rgba(0, 0, 0, 0.09);
    --line-strong: rgba(0, 0, 0, 0.2);
    --accent: #0071e3;
    --accent-hover: #0077ed;
    --accent-text: #0066cc;
    --accent-soft: rgba(0, 113, 227, 0.1);
    --ring: rgba(0, 113, 227, 0.24);
    --ok: #1a7f37;
    --ok-soft: rgba(36, 138, 61, 0.11);
    --warn: #a35200;
    --warn-soft: rgba(201, 110, 0, 0.12);
    --err: #c9001a;
    --err-soft: rgba(215, 0, 21, 0.09);
    --idle: #aeaeb2;
    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.03), 0 10px 30px rgba(0, 0, 0, 0.05);
    --shadow-pop: 0 2px 6px rgba(0, 0, 0, 0.06), 0 24px 60px rgba(0, 0, 0, 0.18);
    --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI Variable Display", "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #05070c;
    --bg-wash:
        radial-gradient(70vmax 46vmax at 8% -6%, rgba(10, 132, 255, 0.2), transparent 70%),
        radial-gradient(60vmax 42vmax at 96% 0, rgba(64, 190, 215, 0.12), transparent 70%);
    --surface: #1c1c1e;
    --surface-2: #2c2c2e;
    --hover: rgba(255, 255, 255, 0.07);
    --bar: rgba(22, 22, 23, 0.78);
    --sheet-bg: #1c1c1e;
    --sheet-card: #2c2c2e;
    --field-bg: rgba(255, 255, 255, 0.06);
    --text: #f5f5f7;
    --text-2: #a1a1a6;
    --line: rgba(255, 255, 255, 0.11);
    --line-strong: rgba(255, 255, 255, 0.26);
    --accent: #0a84ff;
    --accent-hover: #2997ff;
    --accent-text: #2997ff;
    --accent-soft: rgba(10, 132, 255, 0.18);
    --ring: rgba(10, 132, 255, 0.36);
    --ok: #30d158;
    --ok-soft: rgba(48, 209, 88, 0.15);
    --warn: #ff9f0a;
    --warn-soft: rgba(255, 159, 10, 0.16);
    --err: #ff6961;
    --err-soft: rgba(255, 69, 58, 0.16);
    --idle: #636366;
    --shadow-card: 0 0 0 1px rgba(255, 255, 255, 0.05);
    --shadow-pop: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 24px 60px rgba(0, 0, 0, 0.6);
}

@media (prefers-color-scheme: dark) {
    :root[data-theme="auto"] {
        color-scheme: dark;
        --bg: #05070c;
        --bg-wash:
            radial-gradient(70vmax 46vmax at 8% -6%, rgba(10, 132, 255, 0.2), transparent 70%),
            radial-gradient(60vmax 42vmax at 96% 0, rgba(64, 190, 215, 0.12), transparent 70%);
        --surface: #1c1c1e;
        --surface-2: #2c2c2e;
        --hover: rgba(255, 255, 255, 0.07);
        --bar: rgba(22, 22, 23, 0.78);
        --sheet-bg: #1c1c1e;
        --sheet-card: #2c2c2e;
        --field-bg: rgba(255, 255, 255, 0.06);
        --text: #f5f5f7;
        --text-2: #a1a1a6;
        --line: rgba(255, 255, 255, 0.11);
        --line-strong: rgba(255, 255, 255, 0.26);
        --accent: #0a84ff;
        --accent-hover: #2997ff;
        --accent-text: #2997ff;
        --accent-soft: rgba(10, 132, 255, 0.18);
        --ring: rgba(10, 132, 255, 0.36);
        --ok: #30d158;
        --ok-soft: rgba(48, 209, 88, 0.15);
        --warn: #ff9f0a;
        --warn-soft: rgba(255, 159, 10, 0.16);
        --err: #ff6961;
        --err-soft: rgba(255, 69, 58, 0.16);
        --idle: #636366;
        --shadow-card: 0 0 0 1px rgba(255, 255, 255, 0.05);
        --shadow-pop: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 24px 60px rgba(0, 0, 0, 0.6);
    }
}

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

html {
    -webkit-text-size-adjust: 100%;
    background: var(--bg);
}

body {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background-color: var(--bg);
    background-image: var(--bg-wash);
    background-repeat: no-repeat;
    background-attachment: fixed;
    color: var(--text);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.47;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

button, input, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }
code { font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace; }

a:focus-visible, button:focus-visible, label:focus-within > input[type="radio"]:focus-visible {
    outline: 3px solid var(--ring);
    outline-offset: 2px;
}

.link {
    color: var(--accent-text);
    text-decoration: none;
    font-size: inherit;
}
.link:hover { text-decoration: underline; }

/* Thanh trên cùng */
.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    background: var(--bar);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--line);
}
.topbar-inner {
    max-width: 1200px;
    height: 52px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.topbar-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

.brand { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.brand-logo { width: 28px; height: 28px; border-radius: 7px; object-fit: contain; }
.brand-mark {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    flex-shrink: 0;
}
.brand-name {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.icon-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-2);
    transition: background-color 0.15s ease, color 0.15s ease;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }

.ico-sun { display: none; }
:root[data-theme="dark"] .ico-sun { display: block; }
:root[data-theme="dark"] .ico-moon { display: none; }
@media (prefers-color-scheme: dark) {
    :root[data-theme="auto"] .ico-sun { display: block; }
    :root[data-theme="auto"] .ico-moon { display: none; }
}

/* Nút */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 36px;
    padding: 7px 16px;
    border-radius: 980px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.25;
    text-align: center;
    text-decoration: none;
    transition: background-color 0.15s ease, opacity 0.15s ease;
}
.btn:disabled { opacity: 0.55; cursor: default; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--hover); color: var(--text); }
.btn-secondary:hover { background: var(--line); }
.btn-danger { background: var(--err-soft); color: var(--err); }
.btn-danger:hover { background: var(--err-soft); opacity: 0.8; }
.btn-warn { background: var(--warn-soft); color: var(--warn); }
.btn-warn:hover { opacity: 0.8; }
.btn-sm { min-height: 30px; padding: 5px 12px; font-size: 13px; }
.btn-block { width: 100%; min-height: 44px; font-size: 15px; }

/* Ô nhập thường */
.input {
    width: 100%;
    min-height: 44px;
    padding: 10px 14px;
    background: var(--field-bg);
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    font-size: 15px;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input::placeholder { color: var(--text-2); opacity: 0.85; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--ring); }
textarea.input { min-height: 84px; resize: vertical; line-height: 1.45; }

/* Thông báo cổng */
.notice { display: flex; align-items: flex-start; gap: 12px; text-align: left; }
.notice-ico {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--accent-soft);
    color: var(--accent-text);
}
.notice.type-tich_cuc .notice-ico { background: var(--ok-soft); color: var(--ok); }
.notice.type-canh_bao .notice-ico { background: var(--warn-soft); color: var(--warn); }
.notice-body { min-width: 0; flex: 1; font-size: 13px; line-height: 1.45; }
.notice-title { font-weight: 600; color: var(--text); }
.notice-desc { color: var(--text-2); margin-top: 1px; }

/* Thông báo kết quả thao tác */
.flash {
    width: 100%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.45;
    text-align: left;
}
.flash-err { background: var(--err-soft); color: var(--err); }
.flash-ok { background: var(--ok-soft); color: var(--ok); }

/* Sheet: popup trợ giúp đăng nhập và cửa sổ bảo mật */
.sheet-backdrop {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(0, 0, 0, 0.32);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}
.sheet-backdrop.is-open { opacity: 1; visibility: visible; }
.sheet {
    width: 100%;
    max-width: 480px;
    max-height: 100%;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--sheet-bg);
    border-radius: 22px;
    box-shadow: var(--shadow-pop);
    transform: translateY(10px) scale(0.985);
    transition: transform 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.sheet-backdrop.is-open .sheet { transform: none; }
.sheet-lg { max-width: 720px; }
.sheet-head {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 24px 16px;
    background: var(--sheet-bg);
    border-bottom: 1px solid var(--line);
}
.sheet-title { font-family: var(--font-display); font-size: 20px; font-weight: 600; letter-spacing: -0.015em; line-height: 1.25; }
.sheet-sub { margin-top: 3px; font-size: 13px; color: var(--text-2); line-height: 1.45; }
.sheet-body { padding: 20px 24px 24px; display: flex; flex-direction: column; gap: 14px; }
.sheet-close { background: var(--hover); flex-shrink: 0; width: 30px; height: 30px; }

/* Danh ngôn cuối trang */
.quote-foot {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    max-width: 860px;
    margin: 0 auto;
    padding: 20px 24px 28px;
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--text-2);
    text-align: center;
}
.quote-text-wrap { transition: opacity 0.26s ease; }
.quote-text-wrap.is-fading { opacity: 0; }
.quote-author { color: var(--text); font-weight: 500; }
.quote-next-btn { width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--text-2); }
.quote-next-btn:hover { background: var(--hover); color: var(--text); }

@media (max-width: 600px) {
    .topbar-inner { height: 48px; padding: 0 16px; }
    .input { font-size: 16px; }
    .sheet-backdrop { align-items: flex-end; padding: 0; }
    .sheet { max-width: none; max-height: 92dvh; border-radius: 20px 20px 0 0; }
    .sheet-head { padding: 16px 16px 12px; }
    .sheet-body { padding: 16px 16px calc(20px + env(safe-area-inset-bottom)); }
    .quote-foot { padding: 16px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}
