/* login.css — Port từ hr-manager (pages.css + components.css) sang lab xanh lá
 * Chỉ dùng token lab: var(--bg), --card, --text, --muted, --line, --acc, --acc2, --soft, --glow
 * Ghi đè layout cũ của lunasoft (app.css) — thẻ luôn mở, không thu gọn.
 */

/* Page nền phẳng theo lab.
   color-scheme PHAI theo THEME CUA APP (khong theo OS): Chromium to vung
   UA (status bar, overscroll, scrollbar, canvas) theo color-scheme; Android
   dang che do SANG + app force dark ma de "light dark" thi cac vung do
   van mau SANG -> khoang trang tren cung. */
html { background: var(--bg); color-scheme: dark; }
html.light-theme { color-scheme: light; }
body { background: var(--bg); color: var(--text); font-family: var(--f); }
body::before, body::after { display: none !important; }
.sysbar-glow, .navbar-glow { display: none !important; }
/* Dai che dinh/day tren Android (html.is-android do app.js danh dau,
   chi trang auth): may de thanh he thong / tai tho TRONG SUOT nen
   canvas trang lo ra — 2 dai nay to mau nen body (theo theme) khop
   vao dung vung notion, de duoi card (z-index 1, card ve sau nen che
   len tren). Khong anh huong desktop/iOS/home. */
@media (max-width: 768px){
  html.is-android body:not(.home) > .sysbar-glow,
  html.is-android body:not(.home) > .navbar-glow { display: block !important; position: fixed; left: 0; right: 0; z-index: 1; pointer-events: none; background: var(--bg); }
  html.is-android body:not(.home) > .sysbar-glow { top: 0; height: env(safe-area-inset-top, 0px); }
  html.is-android body:not(.home) > .navbar-glow { bottom: 0; height: env(safe-area-inset-bottom, 0px); }
}
body.home .login-card { display: none !important; }

/* Thẻ login — luôn mở 380x520, không collapse */
.login-card {
    position: relative;
    width: min(380px, calc(100% - 32px));
    height: 520px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: transparent;
    border-radius: 12px;
    overflow: hidden;
    flex: none;
    box-shadow: none;
    z-index: 1;
}
/* Ring — màu theo theme lab (brandA/B tự đổi đậm/nhạt theo html.dark) */
.ring { position: absolute; inset: 0; z-index: 0; pointer-events: none; contain: paint; }
.ring i { position: absolute; top: -50%; left: -50%; width: 200%; height: 200%;
    background: conic-gradient(from 0deg, transparent 0deg, transparent 300deg, var(--c) 350deg, transparent 360deg);
    will-change: transform; }
.ring i:nth-child(1) { --c: var(--brandA); }
.ring i:nth-child(2) { --c: var(--brandB); }
.ring i:nth-child(3) { --c: var(--brandA); }
.ring i:nth-child(4) { --c: var(--brandB); }
html.light-theme .ring { opacity: .78; }
html.dark .ring { opacity: 1; }

/* Ruột thẻ — card thật (giống hr-manager .login-card) */
.card-inner {
    position: absolute;
    inset: 3px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 24px 22px 18px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    overflow: hidden;
    z-index: 2;
}
.card-inner::before, .card-inner::after { display: none; }

/* Logo area — to thêm, bỏ vòng tròn, dùng gradient lab */
.logo-area { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding-bottom: 0; flex: none; }
.logo-only { display: flex; align-items: center; justify-content: center; }
#login .canvas {
    display: block; overflow: hidden; position: relative;
    width: 72px; height: 72px; border-radius: 0; background: none;
    box-shadow: none;
}
#login .icon-wrapper { position: absolute; left: 50%; top: 50%; width: 198px; height: 198px; transform: translate(-50%,-50%) scale(0.28); transform-origin: center; }
#login .icon { position: relative; width: 198px; height: 198px; animation: logo-rotate 6s ease-in-out infinite; filter: none; }
#login .icon * { position: absolute; display: block; width: 142px; height: 138px; border-radius: 50%; }
#login .curve1 { left: 54px; top: 20px; box-shadow: 0 27px 0 var(--acc); }
#login .icon .curve1 * { left: -15px; top: 35px; transform: rotate(90deg); }
#login .curve1, #login .curve3 { box-shadow: 0 27px 0 var(--acc); }
#login .curve2, #login .curve4 { box-shadow: 0 27px 0 var(--acc2); animation: curve-color 3s ease-in-out infinite alternate; }
@keyframes logo-rotate { 0%,100%{transform:rotate(45deg) scale(1)} 50%{transform:rotate(55deg) scale(1.05)} }
@keyframes curve-color { 0%{box-shadow:0 27px 0 var(--acc)} 50%{box-shadow:0 27px 0 var(--acc2)} 100%{box-shadow:0 27px 0 var(--acc)} }

.card-inner .brand-name { display: flex; flex-direction: column; align-items: center; text-align: center; }
.card-inner .brand-main {
    font-size: 22px; font-weight: 800; text-transform: uppercase; letter-spacing: .02em;
    background-image: linear-gradient(to right, var(--brandA) 10%, var(--brandB) 50%, var(--brandA) 60%);
    background-size: 200% auto; background-clip: text; -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    animation: egl-brand-shift 3s linear infinite;
}
.card-inner .brand-subtitle {
    font-size: 9px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; margin-top: 2px;
    background-image: linear-gradient(to right, var(--brandSA) 10%, var(--brandSB) 50%, var(--brandSA) 90%);
    background-size: 200% auto; background-clip: text; -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    animation: egl-brand-shift 3s linear infinite;
}

/* Nút theme — góc trái trên */
.theme-btn { position: absolute; top: 11.5px; left: 14px; z-index: 6; width: 28px; height: 28px;
    display: flex; align-items: center; justify-content: center; background: var(--soft); border: 1px solid var(--line);
    border-radius: 6px; color: var(--muted); font-size: 13px; cursor: pointer; transition: all .2s; }
.theme-btn:hover { color: var(--acc); border-color: var(--acc); background: var(--card); }

/* Lang switch — góc phải trên */
.lang-switch { position: absolute; top: 11.5px; right: 14px; z-index: 6; display: flex; gap: 6px; }
.lang-switch button { background: var(--soft); border: 1px solid var(--line); padding: 4px 8px; font-size: 11px; font-weight: 700; letter-spacing: .5px; color: var(--muted); cursor: pointer; border-radius: 6px; }
.lang-switch button[aria-pressed="true"] { color: #fff; background: var(--acc); border-color: var(--acc); }
html.dark .lang-switch button[aria-pressed="true"] { color: #04120a; }

/* Header trong thẻ — divider 72x2 gradient */
.header { position: relative; top: auto; left: auto; transform: none;
    display: flex; align-items: center; justify-content: center; gap: 10px;
    width: 100%; padding: 10px 0 14px; margin-bottom: 14px;
    border-bottom: none; flex: none; }
.header::after { content: ''; position: absolute; bottom: 0; left: 50%; transform: translateX(-50%);
    width: 72px; height: 2px; border-radius: 2px; background: linear-gradient(to right, transparent, var(--acc), transparent); }
.header h2 { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--acc); margin: 0; }
.header i { color: var(--acc); font-size: 14px; }

/* View container */
.views { position: relative; top: auto; width: 100%; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.view { display: none; flex-direction: column; gap: 14px; flex: 1; }
.view.is-active { display: flex; opacity: 1; pointer-events: auto; transform: none; animation: none; }
.view form { display: flex; flex-direction: column; gap: 14px; width: 100%; }

/* Input field — port từ hr-manager components.css */
.input-field { display: flex; flex-direction: column; gap: 6px; }
.input-label-row { display: flex; justify-content: space-between; align-items: center; position: relative; }
.input-label-row label, .input-field label { font-size: 10px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.input-label-row label .required { color: var(--bad); font-size: 12px; margin-left: 4px; }
.validate-success, .validate-error { font-size: 13px; opacity: 0; transition: opacity .2s; position: absolute; right: 0; }
.validate-success { color: var(--ok); }
.validate-success.show { opacity: 1; }
.validate-error { color: var(--bad); }
.validate-error.show { opacity: 1; }
.validate-error[data-tip] { cursor: help; pointer-events: auto; }
/* Da co tooltip JS body-level (.is-tip-open do initStateTips gan) thi an
   tooltip CSS ::after de khong hien doi (y DesignUI §12). */
.validate-error.egx-state.is-tip-open[data-tip]:hover::after { display: none; }
@media (pointer: coarse) {
    .validate-error.egx-state[data-tip] { min-width: 28px; min-height: 28px; display: inline-flex; align-items: center; justify-content: center; }
}
@media (hover:hover) and (pointer:fine){
  .validate-error[data-tip]:hover::after { content: attr(data-tip); position: absolute; top: calc(100% + 8px); right: 0; background: var(--card); color: var(--text); border: 1px solid var(--line); font-size: 11px; font-weight: 600; padding: 6px 10px; border-radius: 6px; white-space: nowrap; box-shadow: 0 8px 20px rgba(0,0,0,.2); z-index: 10; }
}
.field-error { font-size: 11px; color: var(--bad); min-height: 0; margin: 0; display: none; }
.field-error.show { display: block; }
.field-hint { font-size: 11px; color: var(--muted); margin-top: 4px; }
.input-wrapper { position: relative; display: flex; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 6px; transition: border-color .2s, box-shadow .2s; }
.input-wrapper:focus-within { border-color: var(--acc); box-shadow: 0 0 0 3px var(--glow); }
.input-icon { position: absolute; left: 12px; color: var(--muted); font-size: 13px; z-index: 1; pointer-events: none; }
.input-wrapper:focus-within .input-icon { color: var(--acc); }
.form-input { width: 100%; padding: 10px 12px 10px 38px; background: transparent; border: 0; outline: 0; color: var(--text); font-size: 13px; font-family: inherit; }
.form-input::placeholder { color: var(--muted); }
.login-password-input { padding-right: 40px !important; }
.login-toggle-password { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: none; border: 0; color: var(--muted); cursor: pointer; padding: 4px; font-size: 13px; }
.login-toggle-password:hover { color: var(--acc); }

/* Options: toggle + forgot — LUON 1 hang: Ghi nho ben trai, Quen mat khau
   ben phai; nhan duoc phep co lai/xuong dong, link khong bao gio rot hang. */
.login-options { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; padding: 0; flex-wrap: nowrap; }
.toggle-switch-wrapper { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1 1 auto; }
.toggle-switch { position: relative; width: 38px; height: 22px; flex: none; }
.toggle-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; inset: 0; background: var(--soft); border: 1px solid var(--line); border-radius: 999px; cursor: pointer; transition: all .2s; }
.toggle-slider::before { content: ""; position: absolute; width: 16px; height: 16px; left: 2px; bottom: 2px; background: var(--muted); border-radius: 50%; transition: all .2s; }
.toggle-switch input:checked + .toggle-slider { background: var(--acc); border-color: var(--acc); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(16px); background: #fff; }
html.dark .toggle-switch input:checked + .toggle-slider::before { background: #04120a; }
.toggle-label { font-size: 11px; color: var(--muted); font-weight: 600; cursor: pointer; min-width: 0; line-height: 1.3; overflow-wrap: break-word; }
.login-forgot-link { background: none; border: 0; padding: 0; font-size: 11px; font-weight: 600; color: var(--acc); cursor: pointer; text-decoration: none; flex: none; white-space: nowrap; margin-left: auto; }
.login-forgot-link:hover { text-decoration: underline; }

/* Nút login */
.login-btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 11px 16px; background: var(--acc); color: #fff; border: 0; border-radius: 6px; cursor: pointer; font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; transition: all .2s; }
html.dark .login-btn { color: #04120a; }
.login-btn:hover { filter: brightness(1.07); transform: translateY(-1px); box-shadow: 0 8px 20px var(--glow); }
.login-btn:active { transform: none; box-shadow: none; }
.login-btn:disabled { opacity: .6; cursor: wait; }

/* Forgot slider support (nếu dùng login-form-slider cũ) */
.login-form-slider { position: relative; overflow: hidden; }
.login-form-slider .form-panel { transition: transform .35s var(--ease), opacity .35s var(--ease); width: 100%; }
.login-form-slider .form-panel.slide-left { transform: translateX(-30px); opacity: 0; pointer-events: none; position: absolute; top: 0; left: 0; }
.login-form-slider .form-panel.slide-right { transform: translateX(30px); opacity: 0; pointer-events: none; position: absolute; top: 0; left: 0; }
.login-form-slider .form-panel.active { transform: translateX(0); opacity: 1; pointer-events: auto; position: relative; }

/* Theme/lang switch cũ của hr-manager (nếu render) */
.login-theme-switch { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); text-align: center; }
.login-theme-switch .theme-title { font-size: 10px; font-weight: 700; letter-spacing: .06em; color: var(--muted); text-transform: uppercase; margin-bottom: 8px; }
.login-theme-switch .theme-buttons { display: flex; justify-content: center; gap: 8px; }
.login-theme-switch .theme-btn { position: static; width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line); background: var(--soft); }
.login-theme-switch .theme-preview { display: block; width: 14px; height: 14px; border-radius: 50%; background: var(--theme-preview); }
.login-lang-switch { display: flex; justify-content: center; gap: 8px; margin-top: 10px; }
.login-lang-switch .lang-btn { padding: 4px 10px; border: 1px solid var(--line); border-radius: 6px; font-size: 11px; font-weight: 700; text-decoration: none; color: var(--muted); background: var(--soft); }
.login-lang-switch .lang-btn.active { background: var(--acc); color: #fff; border-color: var(--acc); }

/* Hint / links phụ */
.hint { color: var(--muted); font-size: 12px; line-height: 1.6; text-align: center; margin: 0 0 6px; }
.forgot-email-hint { display: flex; align-items: center; gap: 6px; padding: 8px 10px; background: var(--soft); border: 1px solid var(--line); border-radius: 6px; font-size: 11px; color: var(--muted); margin-top: 6px; }
.forgot-email-hint[hidden] { display: none !important; }
.links { display: flex; justify-content: center; width: 100%; margin-top: 8px; }

/* Quên mật khẩu: khoảng cách chuẩn giữa trường và nút (khắc phục quá sát) */
[data-form="forgot"] [data-step] { display: flex; flex-direction: column; gap: 16px; }
[data-form="forgot"] .input-field { margin-bottom: 0; }
[data-form="forgot"] .login-btn { margin-top: 2px; }
[data-form="forgot"] .login-forgot-link { display: inline-flex; align-items: center; gap: 6px; }

/* Alias tpl-* (forgot modal) sang lab — dùng var lab */
.tpl-form-overlay { position: fixed; inset: 0; z-index: 13000; display: none; align-items: center; justify-content: center; padding: 16px; background: rgba(0,0,0,.45); }
.tpl-form-overlay.is-show { display: flex; }
.tpl-form-veil { position: absolute; inset: 0; }
.tpl-form-panel { position: relative; width: min(440px, 100%); background: var(--card); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; box-shadow: 0 18px 44px rgba(0,0,0,.35); }
.tpl-form-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.tpl-group-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; display: flex; align-items: center; gap: 8px; }
.tpl-page-btn { width: 28px; height: 28px; border: 1px solid var(--line); border-radius: 6px; background: var(--soft); color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.tpl-pipe { display: flex; flex-direction: column; gap: 12px; padding: 14px; background: var(--soft); border-top: 1px solid var(--line); }
.tpl-pipe-head { display: flex; align-items: center; gap: 12px; }
.tpl-pipe-id { width: 40px; height: 40px; border-radius: 6px; background: var(--card); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; font-size: 18px; color: var(--acc); }
.tpl-pipe-id.is-spinning i { animation: egx-spin .8s linear infinite; }
.tpl-pipe-titles { flex: 1; min-width: 0; }
.tpl-pipe-title { font-size: 13px; font-weight: 700; }
.tpl-pipe-sub { font-size: 11px; color: var(--muted); }
.tpl-pipe-pct { padding: 4px 10px; border-radius: 6px; background: var(--card); border: 1px solid var(--line); font-size: 13px; font-weight: 700; color: var(--acc); }
.tpl-pipe-trough { width: 100%; height: 14px; border-radius: 6px; background: var(--card); border: 1px solid var(--line); padding: 2px; overflow: hidden; }
.tpl-pipe-bar { height: 100%; width: 0; border-radius: 6px; background: linear-gradient(to right, var(--acc2), var(--acc)); transition: width .3s; }
.tpl-pipe-steps { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; text-align: center; }
.tpl-pipe-step { padding: 8px 4px; border-radius: 6px; background: var(--card); border: 1px solid var(--line); font-size: 10px; font-weight: 700; color: var(--muted); }
.tpl-pipe-step.is-active { color: var(--acc); border-color: var(--acc); background: var(--soft); }
.tpl-pipe-step.is-done { color: var(--ok); }

/* Toast DUNG CHUNG MAU TEMPLATE: nguon duy nhat la .egx-toast trong
   egx-demo.css (nap toan cuc). KHONG dinh nghia .toast* o day nua. */

/* Preloader cu (.preloader*): chi giu cho HTML/JS cu da cache trong PWA.
   NGUON DUY NHAT cho .egx-pre* la egx-demo.css (port tu mau.html) —
   CAM dinh nghia .egx-pre* o day (tung lech logo transparent/no-border
   vi trung selector, phai sua lan 2). */
.preloader[hidden] { display: none !important; }
.preloader { position: fixed; inset: 0; z-index: 13000; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(0,0,0,.45); opacity: 0; pointer-events: none; transition: opacity .18s ease-out; }
.preloader.is-show { opacity: 1; pointer-events: auto; }
.preloader-card { width: 100%; max-width: 380px; background: var(--card); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 18px 44px rgba(0,0,0,.35); padding: 28px; display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.preloader-logo { width: 76px; height: 76px; border-radius: 50%; background: var(--soft); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.preloader-text { display: flex; flex-direction: column; gap: 4px; align-items: center; }
.preloader-title { font-size: 18px; font-weight: 700; text-transform: uppercase; letter-spacing: .02em; }
.preloader-status { font-size: 12px; color: var(--muted); }
.preloader-trough { position: relative; width: 100%; height: 14px; border-radius: 6px; background: var(--soft); border: 1px solid var(--line); padding: 2px; overflow: hidden; }
.preloader-bar { height: 100%; border-radius: 6px; background: linear-gradient(to right, var(--acc2), var(--acc), var(--acc2)); transition: width .3s ease; }
/* Bar xac dinh % (preloader.js set width truc tiep) mac dinh 0; bar
   indeterminate (sweep) KHONG duoc set width de trinh duyet tu giai
   width tu cap left/right cua keyframes egx-sweep. */
.preloader-bar:not(.is-indeterminate) { width: 0; }
.preloader-bar.is-indeterminate { position: absolute; background: linear-gradient(90deg, var(--acc2), var(--acc), var(--acc2)); border-radius: 6px; animation: egx-sweep 1.8s ease-in-out infinite; }
/* Preloader cu: fan + entrance cho HTML cu (.preloader-*) da cache trong PWA.
   Markup moi (egx-pre*) lay tu egx-demo.css — KHONG them rule .egx-pre* o day. */
#preloader.is-show .preloader-card { animation: egx-pre-in .3s var(--ease) both; }
#preloader.is-show .preloader-logo { animation: elb-av .4s var(--ease) .05s both; }
#preloader.is-show .preloader-text { animation: elb-sec .3s var(--ease) .1s both; }
#preloader.is-show .preloader-trough { animation: elb-sec .3s var(--ease) .16s both; }

/* ===== Modal dùng chung (#modal: confirm/alert) =====
   Trước đây style nằm trong app.css đã xoá -> modal render ở cuối body,
   bị control_footer (fixed, z 35) che nút Xác nhận nên bấm Đăng xuất
   không phản hồi. Khôi phục bằng token lab, z 12000 (trên footer, dưới
   toast 14000). */
.modal[hidden] { display: none !important; }
.modal { position: fixed; inset: 0; z-index: 12000; display: flex; align-items: center; justify-content: center;
    padding: 20px; opacity: 0; transition: opacity .18s ease-out; }
.modal.is-show { opacity: 1; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .55); }
.modal-card { position: relative; z-index: 1; width: min(380px, 100%); max-height: calc(100dvh - 40px); overflow-y: auto;
    background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 18px;
    display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
    box-shadow: 0 18px 44px rgba(0, 0, 0, .35);
    transform: translateY(10px) scale(.98); transition: transform .2s var(--ease); }
.modal.is-show .modal-card { transform: none; }
.modal-icon { width: 44px; height: 44px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
    background: var(--soft); border: 1px solid var(--line); color: var(--acc); font-size: 18px; flex: none; }
.modal-title { margin: 2px 0 0; font-size: 14px; font-weight: 700; text-transform: uppercase; letter-spacing: .02em; }
.modal-msg { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.modal-code { display: none; font-family: ui-monospace, monospace; font-size: 11px; color: var(--muted);
    border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; }
.modal-code.is-show { display: inline-block; }
.modal-actions { display: flex; gap: 8px; width: 100%; margin-top: 8px; }
.modal-btn { flex: 1 1 0; min-width: 0; padding: 11px 14px; border-radius: 6px; border: 1px solid var(--line);
    background: var(--soft); color: var(--text); font-family: inherit; font-size: 12px; font-weight: 700;
    cursor: pointer; transition: filter .2s, background .2s; }
.modal-btn:hover { filter: brightness(1.06); }
.modal-btn.confirm { background: var(--acc); border-color: var(--acc); color: #fff; }
html.dark .modal-btn.confirm { color: #04120a; }
@media (max-width: 360px) { .modal-actions { flex-direction: column-reverse; } }

/* Body flex center chỉ cho trang auth (login/forgot) — home giữ block */
body:not(.home) { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; min-height: 100dvh; gap: 0; padding: 16px; overflow-y: auto; }
body.home { display: block; min-height: auto; padding: 0; overflow: hidden; }
body.home .apphome { display: flex; height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; }
body.home .apphome .egl-main { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: visible; }
/* Scroll nam tren .container (noi dung), control_header nam NGOAI vung
   cuon nen khong bi anh huong boi scroll doc */
body.home .apphome .egl-main .container { flex: 1; min-height: 0; overflow-y: auto; }
/* Submenu sidebar theo lab (.egl-fly): cap 3 lech sang phai panel cha,
   caret-right tu dong ve cuoi hang, opener cap 2 mo thi doi mau accent */
.egl-fly.level3 { left: 492px; }
html.side-collapsed .egl-fly.level3 { left: 332px; }
.egl-fly a .fa-caret-right { margin-left: auto; color: var(--muted); font-size: 10px; }
.egl-fly a.open { color: var(--acc); }
.egl-fly a.open .fa-caret-right { color: var(--acc); transform: rotate(90deg); }
/* Submenu bay: truot nhe tu trai sang phai khi xuat hien (lab khong co
   san animation cho .egl-fly; dung var(--ease) + thoi gian ngan de dong
   bo cam giac voi popup .egl-panel) */
@keyframes egl-fly-in { from { opacity: 0; transform: translateX(-14px); } }
.egl-fly.open { animation: egl-fly-in .22s var(--ease); }
@media (prefers-reduced-motion: reduce) { .egl-fly.open { animation: none; } }
/* notification-badge port tu hr-manager/components.css sang token lab
   (badge.js toggle .is-show; CSS cu home.css da xoa nen phai them lai).
   Do: an mac dinh, hien khi .is-show; sidebar/footer neo vao icon. */
.notification-badge { position: absolute; top: -5px; right: -5px; min-width: 16px; width: auto; height: 16px;
    padding: 0 4px; background: var(--bad); color: #fff; font-size: 10px; font-weight: 700; border-radius: 999px;
    display: none; align-items: center; justify-content: center; line-height: 1; }
.notification-badge.is-show { display: inline-flex; }
.egl-nav .nic, .egl-fly a .nic, .egl-foot .fic { position: relative; }
.egl-nav .nic .notification-badge, .egl-fly a .nic .notification-badge { top: -13px; right: -14px; }
[data-notif] { position: relative; }
[data-notif] .notification-badge { top: -6px; right: -6px; }
/* Dropdown Mau (Color) gon hon lab (theo yeu cau rieng): giu nguyen
   markup + token lab, chi siet spacing va swatch nho lai chut */
[data-egx-cdrop] .egx-ctitle { padding: 2px 4px; }
[data-egx-cdrop] .egx-csub { padding: 6px 4px 0; }
[data-egx-cdrop] .egx-cgrid { gap: 4px; padding: 4px; }
[data-egx-cdrop] .egx-cgrid button { width: 24px; height: 24px; padding: 0; justify-self: center; }
/* Swatch giu nguyen mau goc khi hover: rule chung .egx-fdrop
   button:hover{background:var(--soft)} (dark = gan den) de len mau
   swatch — chi giu scale phong to cua lab */
[data-egx-cdrop] .egx-cgrid button:hover { background: var(--sw); }
[data-egx-cdrop] .egx-crows { gap: 3px; padding: 0 4px; }
[data-egx-cdrop] .egx-crow { gap: 6px; }
[data-egx-cdrop] .egx-crow span:last-child { min-width: 24px; }
[data-egx-cdrop] .egx-chexrow { padding: 6px 4px 2px; gap: 6px; }
[data-egx-cdrop] .egx-chexrow input { padding: 7px 8px; }
[data-egx-cdrop] .egx-capply { padding: 6px 10px; font-size: 11px; }
/* egl-brand sidebar: ép đúng mẫu lab (trước bị lệch do login.css đè body flex) */
body.home .egl-brand { display: flex; align-items: center; gap: 10px; margin: 12px 12px 0; padding: 12px; }
body.home .egl-side .egl-logo, body.home .egl-side .egl-fan, body.home .egl-side .egl-fan .canvas { flex: none; }
body.home .egl-side .egl-fan .canvas { width: 52px; height: 52px; }
body.home .egl-brandtx { min-width: 0; flex: 1; text-align: left; }
body.home .egl-brandtx b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logo-area { opacity: 1 !important; }
.view { opacity: 1 !important; }
.login-card::before { display: none !important; }
#buildTag { text-align: center; font-size: 10px; color: var(--muted); margin-top: 10px; }

/* Nút Clear Data — kéo được, z-index cao nhất, chỉ hiện khi devmode */
#clearDataBtn { position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); width: 44px; height: 44px; display: none; align-items: center; justify-content: center; border-radius: 12px; background: var(--card); border: 1px solid var(--line); color: var(--acc); box-shadow: 0 8px 24px rgba(0,0,0,.28), 0 2px 8px rgba(0,0,0,.18); cursor: grab; z-index: 15000; touch-action: none; user-select: none; -webkit-user-select: none; }
body.devmode #clearDataBtn { display: flex; }
#clearDataBtn:active, #clearDataBtn.is-drag { cursor: grabbing; opacity: .92; transform: scale(.98); }
#clearDataBtn i { font-size: 16px; pointer-events: none; }

/* Mobile: giong hr-manager (pages.css: @media 768px + 360px) —
   wrapper padding 15px, card padding hep hon, logo thu nho
   (canvas 72->68, icon scale .28->.26), brand giu 22px dung hr. */
@media (max-width: 768px){
  body:not(.home) { padding: 15px; }
  .card-inner { padding: 25px 20px 18px; }
  .logo-area { gap: 8px; }
  #login .canvas { width: 68px; height: 68px; }
  #login .icon-wrapper { transform: translate(-50%, -50%) scale(0.26); }
}
/* Mobile nho: card full width, cao tu nhien */
@media (max-width: 420px){
  body { justify-content: center; padding: 12px; }
  .login-card { width: 100%; height: auto; min-height: 500px; }
  .card-inner { position: relative; inset: auto; width: 100%; }
  .ring { display: none; }
}
/* Android rieng (html.is-android do app.js danh dau, chi trang auth):
   khoa viewport bang dvh de thanh dia chi an/hien khong gay scroll thua;
   tat overscroll de khong lo nen trang khi keo; card tu cuon trong khi
   man hinh lun thap. Desktop/iOS giu nguyen. */
html.is-android body:not(.home) { height: 100vh; height: 100dvh; }
@media (max-width: 420px){
  html.is-android body:not(.home) { overflow: hidden; overscroll-behavior-y: none; }
  html.is-android body:not(.home) .login-card { min-height: 0; max-height: 100%; overflow-y: auto; }
}
/* Man hinh rat nho: GIU 1 hang nho/pass (khong stack -> khong rot hang),
   chi thu nho chu + khoang cach cho vua. */
@media (max-width: 360px){
  .card-inner { padding: 20px 15px 16px; }
  .login-options { gap: 8px; }
  .toggle-switch-wrapper { gap: 6px; }
  .toggle-label, .login-forgot-link { font-size: 10.5px; }
}
@media (max-height: 560px){
  .login-card { height: 440px; }
  .card-inner { padding: 18px; }
}
