/* Cùng bộ màu và kiểu với web Chấm Công Host Live (luong-host/app/src/theme.css). */
:root {
  color-scheme: light;
  --ui-font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Inter', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --bg: #f5f5f7;
  --card: #ffffff;
  --text: #1d1d1f;
  --muted: #5c5c62;
  --faint: #86868b;
  --line: #d2d2d7;
  --line-soft: #e8e8ed;
  --accent: #0071e3;
  --accent-dark: #0077ed;
  --link: #0066cc;
  --hover-blue: #eaf3fc;
  --disabled: #e2e2e5;
  --chip-bg: #e7f1ff;
  --chip-ink: #0b3d91;
  --good: #1f7a3d;
  --warn: #b64400;
  --header-bg: rgb(255 255 255 / .96);
  --radius-card: 8px;
  --radius-button: 980px;
}
/* Mặc định luôn sáng; giao diện tối chỉ bật khi chọn trong Cài đặt (data-theme="dark" trên <html>) */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #18191a; --card: #242526; --text: #e4e6eb; --muted: #b0b3b8; --faint: #8a8d91;
  --line: #3e4042; --line-soft: #35373a; --accent: #2374e1; --accent-dark: #3b86ee; --link: #6aaeff;
  --hover-blue: rgba(106, 174, 255, .16); --disabled: #3a3b3c; --chip-bg: #1f3a5f; --chip-ink: #9ccbff;
  --good: #5fd38a; --warn: #ff9f5a; --header-bg: rgb(36 37 38 / .94);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 17px/1.47 var(--ui-font); letter-spacing: -.022em; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; -webkit-tap-highlight-color: transparent; }
main { max-width: 640px; margin: 0 auto; padding: 0 16px 32px; }
h2, h3, p { margin: 0; }
h2, h3, b { font-weight: 600; }
:where(a, button, input, textarea, select, summary):focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* Thang chữ (theo web Chấm Công / Apple):
   34 tiêu đề lớn · 28 tháng · 22 tiêu đề mục · 17 nội dung · 15 phụ · 13 nhãn · 12 chú thích */

/* Thanh trên cùng: tháng + dải ngày (tab Lịch), tên mục (tab khác) */
.top { position: sticky; top: 0; z-index: 10; overflow: hidden; background: var(--header-bg); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); border-bottom: 1px solid var(--line-soft); padding-top: env(safe-area-inset-top); }
.top-inner { max-width: 640px; margin: 0 auto; padding: 10px 20px 6px; }
#top-title { margin: 0; font-size: 24px; font-weight: 700; line-height: 1.2; letter-spacing: -.03em; }
.top:not([data-tab="list"]) .top-inner { padding-bottom: 10px; }
.top:not([data-tab="list"]) .week { display: none; }
.top::after { content: ''; position: absolute; left: 0; bottom: 0; width: 35%; height: 2px; background: var(--accent); opacity: 0; transform: translateX(-100%); }
.top.loading::after { opacity: 1; animation: loadbar 1.1s ease-in-out infinite; }
@keyframes loadbar { to { transform: translateX(300%); } }
.week { position: relative; max-width: 640px; margin: 0 auto; display: flex; overflow-x: auto; padding: 0 8px 8px; scroll-snap-type: x mandatory; scroll-padding-inline: 8px; scrollbar-width: none; }
.week::-webkit-scrollbar { display: none; }
.week .wd { flex: 0 0 calc(100% / 7); flex-direction: column; gap: 2px; min-height: 60px; padding: 4px 0; border: 0; border-radius: 12px; background: transparent; color: var(--text); }
.week .wd:nth-child(7n + 1) { scroll-snap-align: start; }
.week .wd:hover:not(:disabled) { background: transparent; }
.wd-name { font-size: 11px; font-weight: 500; color: var(--faint); letter-spacing: 0; }
.wd-num { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; transition: background-color .2s, color .2s; }
.wd.free .wd-num { color: var(--faint); font-weight: 400; }
.wd.today .wd-name, .wd.today .wd-num { color: var(--link); }
.wd.sel .wd-num { background: var(--accent); color: #fff; font-weight: 600; }
.wd-dots { display: flex; gap: 3px; height: 5px; }
.wd-dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--faint); }
.wd-dots i.p-shopee { background: #ee4d2d; }
.wd-dots i.p-tiktok { background: var(--text); }

/* Thanh tab nổi ở dưới, nền mờ; nội dung mờ dần phía sau để không lộ chữ lổn nhổn */
body::after { content: ''; position: fixed; z-index: 19; left: 0; right: 0; bottom: 0; height: calc(88px + env(safe-area-inset-bottom)); background: linear-gradient(to bottom, color-mix(in srgb, var(--bg) 0%, transparent), var(--bg) 75%); pointer-events: none; }
.tabs { position: fixed; z-index: 20; left: 50%; bottom: max(12px, env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(calc(100% - 32px), 420px); display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 5px; border-radius: 999px; background: rgb(255 255 255 / .78); border: .5px solid rgb(0 0 0 / .08); box-shadow: 0 10px 30px rgb(0 0 0 / .12), 0 1px 2px rgb(0 0 0 / .06); backdrop-filter: saturate(180%) blur(24px); -webkit-backdrop-filter: saturate(180%) blur(24px); }
[data-theme="dark"] .tabs { background: rgb(44 44 46 / .8); border-color: rgb(255 255 255 / .1); box-shadow: 0 10px 30px rgb(0 0 0 / .5); }
.tabs button { flex-direction: column; gap: 2px; min-height: 52px; padding: 0 4px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font-size: 11px; font-weight: 500; letter-spacing: 0; transition: background-color .2s, color .2s, transform .12s; }
.tabs svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabs button:hover:not(:disabled) { background: transparent; color: var(--text); }
.tabs button[aria-current], .tabs button[aria-current]:hover:not(:disabled) { background: var(--hover-blue); color: var(--link); font-weight: 600; }
.tabs button[aria-current] svg { stroke-width: 2.1; }
[data-theme="dark"] .tabs button[aria-current] { background: rgb(255 255 255 / .12); color: #fff; }

/* Nút: viên thuốc viền xanh, nút chính tô xanh */
button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 20px; border: 1px solid var(--link); border-radius: var(--radius-button); background: transparent; color: var(--link); font: inherit; font-size: 15px; font-weight: 500; letter-spacing: -.01em; white-space: nowrap; cursor: pointer; transition: background-color .18s, color .18s, transform .12s; }
button:active:not(:disabled) { transform: scale(.97); }
button:hover:not(:disabled) { background: var(--hover-blue); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover:not(:disabled) { background: var(--accent-dark); }
button.quiet { border-color: transparent; color: var(--muted); padding: 0 12px; }
button.small { min-height: 36px; font-size: 14px; padding: 0 16px; }
button.quiet.small { padding: 0 10px; }
button:disabled { background: var(--disabled); border-color: var(--disabled); color: var(--faint); cursor: default; }
.icon-btn { width: 44px; min-height: 44px; padding: 0; border: 0; color: var(--muted); font-size: 22px; font-weight: 400; }

#status:empty { display: none; }
#status { max-width: 640px; margin: 0 auto; padding: 12px 16px 0; color: var(--muted); font-size: 13px; letter-spacing: -.01em; }
#status.bad { color: var(--warn); font-weight: 600; }

/* Khối */
.card, .group { background: var(--card); border: 1px solid var(--line-soft); border-radius: 12px; }
.card { padding: 20px; margin-top: 12px; }
.eyebrow { color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; margin-bottom: 8px; }
/* Thẻ ca tiếp theo: nền xanh nhấn, chữ trắng */
.hero { position: relative; margin-top: 16px; padding: 22px 20px 18px; border-radius: 20px; color: #fff; background: radial-gradient(120% 90% at 100% 0%, rgb(255 255 255 / .16), transparent 55%), linear-gradient(150deg, #2b8cf3 0%, #0a6ad8 55%, #0052b8 100%); box-shadow: 0 14px 34px -14px rgb(0 90 200 / .6); }
[data-theme="dark"] .hero { background: radial-gradient(120% 90% at 100% 0%, rgb(255 255 255 / .1), transparent 55%), linear-gradient(150deg, #1f6fd6, #0b4ea6); box-shadow: none; }
.hero .eyebrow { color: rgb(255 255 255 / .78); margin-bottom: 6px; }
.hero .time { font-size: 44px; font-weight: 700; line-height: 1.08; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.hero .what { font-size: 17px; margin-top: 6px; color: rgb(255 255 255 / .92); }
.hub-chip { position: relative; display: inline-flex; align-items: center; gap: 6px; margin-top: 14px; padding: 6px 30px 6px 10px; border-radius: 999px; background: rgb(255 255 255 / .16); color: #fff; font-size: 14px; font-weight: 500; letter-spacing: -.01em; }
.hub-chip::after { content: ''; position: absolute; right: 13px; top: 50%; width: 6px; height: 6px; border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor; transform: translateY(-70%) rotate(45deg); opacity: .8; }
.hub-chip .pin svg { display: block; width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; }
.hub-chip select { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; margin: 0; padding: 0; opacity: 0; font-size: 16px; cursor: pointer; }
.hero-stats { display: flex; align-items: center; gap: 28px; margin-top: 18px; padding-top: 16px; border-top: 1px solid rgb(255 255 255 / .22); }
.hero-stats.wrap { flex-wrap: wrap; gap: 10px; }
.stat b { display: block; font-size: 22px; font-weight: 700; line-height: 1.15; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat span { display: block; margin-top: 2px; color: rgb(255 255 255 / .75); font-size: 12px; letter-spacing: 0; }
.stat.late b { display: inline-block; padding: 0 8px; border-radius: 8px; background: #ff3b30; }
.hero-note { flex-basis: 100%; color: rgb(255 255 255 / .88); font-size: 14px; }
.hero .hero-btn { display: inline-flex; align-items: center; min-height: 40px; margin-left: auto; padding: 0 18px; border: 0; border-radius: 999px; background: #fff; color: #0060d0; font-size: 15px; font-weight: 600; text-decoration: none; }
.hero .hero-stats.wrap .hero-btn { margin-left: 0; }
.hero .hero-btn.ghost, .hero .hero-btn.ghost:hover:not(:disabled) { background: rgb(255 255 255 / .18); color: #fff; }
.hero .hero-btn:hover:not(:disabled) { background: #fff; }
.section-title { display: flex; align-items: center; gap: 12px; margin: 36px 0 4px; font-size: 22px; line-height: 1.27; letter-spacing: -.02em; }
.count { margin-left: auto; padding: 4px 12px; border: 1px solid var(--line); border-radius: var(--radius-button); color: var(--muted); font-size: 13px; font-weight: 400; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.day { margin: 22px 0 8px; padding-left: 4px; color: var(--muted); font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.day.today { color: var(--link); }
.section-title + .group { margin-top: 12px; }

/* Một dòng ca: cột giờ cố định bên trái, nội dung bên phải → mọi dòng thẳng hàng */
.item { display: grid; grid-template-columns: 52px minmax(0, 1fr); column-gap: 16px; padding: 14px 16px; }
.item + .item { border-top: 1px solid var(--line-soft); }
.item .t { display: flex; flex-direction: column; font-variant-numeric: tabular-nums; line-height: 1.3; padding-top: 1px; }
.item .t b { font-size: 17px; }
.item .t span { color: var(--muted); font-size: 15px; }
.line { display: flex; align-items: center; gap: 8px; min-width: 0; }
.brand-name { font-size: 17px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip { flex: none; padding: 2px 10px; border-radius: var(--radius-button); background: var(--chip-bg); color: var(--chip-ink); font-size: 12px; font-weight: 500; line-height: 1.5; }
.chip.none, .chip.p-none { background: var(--disabled); color: var(--muted); }
.chip.p-shopee { background: rgb(238 77 45 / .12); color: #c4361a; }
.chip.p-tiktok { background: #1d1d1f; color: #fff; }
[data-theme="dark"] .chip.p-shopee { background: rgb(255 120 90 / .16); color: #ff9a80; }
[data-theme="dark"] .chip.p-tiktok { background: #e4e6eb; color: #18191a; }
/* Danh sách theo ngày: một khối chung, mỗi ngày một dải tiêu đề */
.agenda { overflow: hidden; }
.section-title + .agenda { margin-top: 12px; }
.agenda-block + .agenda-block { border-top: 1px solid var(--line-soft); }
.agenda-day { padding: 9px 16px; border-bottom: 1px solid var(--line-soft); background: color-mix(in srgb, var(--bg) 55%, var(--card)); color: var(--muted); font-size: 13px; font-weight: 600; letter-spacing: 0; }
.agenda-day.today { color: var(--link); }
.hours { margin-left: auto; flex: none; color: var(--muted); font-size: 15px; font-variant-numeric: tabular-nums; }
.sub { color: var(--muted); font-size: 15px; line-height: 1.4; margin-top: 2px; }
.card > .sub { margin: -4px 0 16px; }
.warn { color: var(--warn); font-size: 13px; font-weight: 600; line-height: 1.4; margin-top: 6px; }
.ok { color: var(--good); font-size: 14px; font-weight: 600; margin-right: auto; }
.note { font-size: 15px; margin-top: 6px; white-space: pre-wrap; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; align-items: center; }
.actions.center { justify-content: center; margin: 16px 0 0; }
.actions a { color: var(--link); font-size: 15px; font-weight: 500; text-decoration: none; padding: 0 4px; }
.hero .actions { margin-top: 20px; }
.hero .actions .sub { flex-basis: 100%; margin: 0; }
.empty { color: var(--muted); text-align: center; padding: 40px 0; font-size: 15px; }

/* Form tick hoàn thành */
.editor { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.editor .wide { grid-column: 1 / -1; }
label { display: block; font-size: 13px; color: var(--muted); }
input[type=url], input[type=password], input[type=time], textarea, select { display: block; width: 100%; margin-top: 6px; min-height: 44px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--text); font: inherit; font-size: 16px; letter-spacing: 0; transition: border-color .18s; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--hover-blue); }
input::placeholder, textarea::placeholder { color: var(--faint); }
select { width: auto; margin: 0; min-height: 44px; padding: 0 36px 0 16px; border-radius: var(--radius-button); font-size: 15px; -webkit-appearance: none; appearance: none; background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%2386868b' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E") no-repeat right 14px center; }
textarea { resize: vertical; min-height: 64px; }
form.card label { margin-bottom: 16px; }
.card h3 { font-size: 17px; margin-bottom: 16px; }
.checks { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-bottom: 16px; }
form.card .checks label, .checks label { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; margin: 0; border: 1px solid var(--line); border-radius: var(--radius-button); font-size: 14px; white-space: nowrap; color: var(--text); cursor: pointer; transition: background-color .18s, border-color .18s; }
.checks label:has(input:checked) { border-color: var(--accent); background: var(--hover-blue); color: var(--link); font-weight: 500; }
.checks input { position: absolute; opacity: 0; pointer-events: none; }
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); padding: 3px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line-soft); }
.segmented label { display: flex; align-items: center; justify-content: center; min-height: 36px; border-radius: 8px; font-size: 15px; color: var(--text); cursor: pointer; transition: background-color .2s; }
.segmented label:has(input:checked) { background: var(--card); font-weight: 600; box-shadow: 0 1px 3px rgb(0 0 0 / .12); }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
#msg { color: var(--muted); font-size: 15px; margin-top: 12px; text-align: center; }

/* Tổng tháng giống summary-grid */
.month-bar { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; margin: 8px 0 8px; }
.month-bar h2 { text-align: center; font-size: 20px; line-height: 1.2; letter-spacing: -.02em; }
/* Dashboard chấm công */
.income { margin-top: 4px; padding: 20px; border-radius: 20px; background: var(--card); border: 1px solid var(--line-soft); }
.income-value { font-size: 36px; font-weight: 700; line-height: 1.1; letter-spacing: -.035em; font-variant-numeric: tabular-nums; }
.bar { display: flex; height: 8px; margin-top: 16px; border-radius: 99px; background: var(--line-soft); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .6s cubic-bezier(.22, 1, .36, 1); }
.bar > span.rest { background: color-mix(in srgb, var(--accent) 28%, transparent); border-radius: 0 99px 99px 0; }
.bar.thin { height: 6px; margin-top: 10px; }
.income-max { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-top: 10px; color: var(--muted); font-size: 14px; }
.income-max b { color: var(--text); font-size: 15px; font-variant-numeric: tabular-nums; }
.brand-list { margin-top: 12px; }
.brand-row + .brand-row { border-top: 1px solid var(--line-soft); }
.section-title .tools { margin-left: auto; display: flex; gap: 2px; }
.section-title .tools button { font-weight: 500; letter-spacing: -.01em; }

/* Nhật ký lịch thay đổi */
.changes { margin-top: 16px; padding: 0; }
.changes summary { display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 0 16px; list-style: none; cursor: pointer; font-size: 15px; font-weight: 600; }
.changes .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.changes .dot.on { background: #ff3b30; }
.changes .badge { margin-left: auto; color: var(--muted); font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums; }
.changes summary::-webkit-details-marker { display: none; }
.changes summary::after { content: ''; width: 8px; height: 8px; border-right: 2px solid var(--faint); border-bottom: 2px solid var(--faint); transform: rotate(45deg) translateY(-3px); transition: transform .2s; }
.changes[open] summary::after { transform: rotate(-135deg) translateY(-1px); }
.change { display: grid; grid-template-columns: 52px minmax(0, 1fr); column-gap: 16px; padding: 12px 20px; border-top: 1px solid var(--line-soft); font-size: 15px; line-height: 1.4; }
.change .when { white-space: pre-line; color: var(--muted); font-size: 13px; line-height: 1.3; font-variant-numeric: tabular-nums; padding-top: 2px; }
.change > span:last-child { padding-left: 12px; border-left: 3px solid var(--faint); }
.change.added > span:last-child { border-left-color: var(--good); }
.change.changed > span:last-child { border-left-color: var(--accent); }
.change.removed > span:last-child, .change.gone > span:last-child { border-left-color: var(--warn); }

/* Chân trang */
.foot { display: flex; justify-content: center; padding: 16px 0 calc(104px + env(safe-area-inset-bottom)); }
.product-credit { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; color: var(--muted); font-size: 12px; line-height: 1.5; letter-spacing: 0; }
.product-credit img { display: block; width: 26px; height: 19px; object-fit: contain; position: relative; top: -1px; }
.product-credit b { color: var(--text); font-size: 12px; letter-spacing: .04em; margin-left: 2px; }
[data-theme="dark"] .product-credit img { filter: brightness(0) invert(1); }
[data-theme="dark"] .brand-mark { filter: invert(1) hue-rotate(180deg) brightness(1.2); }

/* Hiệu ứng: hiện dần khi cuộn tới (giống web Chấm Công), form mở ra nhẹ */
.pre { opacity: 0; transform: translateY(40px); }
.pre.in { opacity: 1; transform: none; transition: opacity 1s cubic-bezier(.5, 1, .89, 1), transform 1s cubic-bezier(.5, 1, .89, 1); }
@media (prefers-reduced-motion: no-preference) { .editor { animation: rise .22s ease-out both; } }
@keyframes rise { from { opacity: 0; transform: translateY(-4px); } }

/* Màn giới thiệu ~1,5 giây, giống web Chấm Công (luong-host/app/src/intro.css) */
.brand-intro { position: fixed; inset: 0; z-index: 100; min-height: 100dvh; display: grid; grid-template-rows: 1fr auto; background: #fff; color: var(--text); letter-spacing: -.016em; cursor: pointer; }
.intro-center { align-self: center; justify-self: center; width: min(100%, 720px); padding: 80px 24px 40px; text-align: center; }
.intro-symbol { display: block; width: 88px; height: 88px; margin: 0 auto 24px; background: url('brand/lich-live-mark.svg') center / contain no-repeat; }
.brand-intro h1 { margin: 0; font-size: 44px; font-weight: 600; line-height: 1.07; letter-spacing: -1.2px; }
.intro-eyebrow { max-width: 560px; margin: 20px auto 0; color: var(--muted); font-size: 17px; line-height: 1.47; letter-spacing: -.3px; text-wrap: balance; }
.intro-credit { margin-top: 28px; }
.intro-timeline { display: block; width: 48px; height: 2px; margin: 32px auto 0; background: var(--disabled); overflow: hidden; border-radius: 980px; }
.intro-timeline > span { display: block; height: 100%; background: #2997ff; transform-origin: left; }
.intro-footer { justify-self: center; padding: 0 24px max(24px, env(safe-area-inset-bottom)); text-align: center; }
.support-contact { display: inline-flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 12px; line-height: 1.5; letter-spacing: -.2px; }
.support-contact a { color: var(--link); text-decoration: none; }
@media (min-width: 601px) {
  .intro-symbol { width: 104px; height: 104px; margin-bottom: 28px; }
  .brand-intro h1 { font-size: 56px; letter-spacing: -1.8px; }
  .intro-eyebrow { font-size: 21px; margin-top: 24px; }
}
[data-theme="dark"] .brand-intro { background: #18191a; }
@media (prefers-reduced-motion: no-preference) {
  .intro-symbol { animation: intro-rise 600ms cubic-bezier(.2,.7,.2,1) both; }
  .brand-intro h1 { animation: intro-rise 520ms 100ms cubic-bezier(.2,.7,.2,1) both; }
  .intro-eyebrow, .intro-credit { animation: intro-rise 480ms 220ms cubic-bezier(.2,.7,.2,1) both; }
  .intro-timeline > span { animation: intro-time 800ms linear both; }
  .brand-intro.is-leaving { animation: intro-leave 250ms ease both; }
}
@keyframes intro-rise { from { opacity: 0; transform: translateY(8px); } }
@keyframes intro-time { from { transform: scaleX(0); } }
@keyframes intro-leave { to { opacity: 0; visibility: hidden; } }

/* Kéo xuống để làm mới: vòng tròn hiện dưới thanh trên cùng */
#ptr { position: fixed; z-index: 15; left: 50%; top: calc(env(safe-area-inset-top) + 96px); width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; background: var(--card); box-shadow: 0 2px 10px rgb(0 0 0 / .14); opacity: 0; transform: translate(-50%, 0); pointer-events: none; transition: opacity .2s; }
#ptr svg { width: 20px; height: 20px; fill: none; stroke: var(--faint); stroke-width: 2.4; stroke-linecap: round; transform: rotate(-90deg); }
#ptr circle { stroke-dasharray: 57; stroke-dashoffset: 57; }
#ptr.ready svg, #ptr.spin svg { stroke: var(--accent); }
#ptr.spin { transition: transform .2s, opacity .2s; }
#ptr.spin circle { stroke-dashoffset: 40; }
#ptr.spin svg { animation: ptr-spin .7s linear infinite; }
@keyframes ptr-spin { to { transform: rotate(270deg); } }

/* Hộp xác nhận lời nhắc, trồi lên từ dưới */
.sheet-wrap { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; background: rgb(0 0 0 / .35); }
.sheet { width: min(100%, 520px); padding: 24px 20px calc(20px + env(safe-area-inset-bottom)); border-radius: 20px 20px 0 0; background: var(--card); text-align: center; }
.sheet h2 { font-size: 22px; letter-spacing: -.02em; }
.sheet-body { margin: 14px 0 20px; }
.sheet-body p { font-size: 17px; line-height: 1.5; }
.sheet button { width: 100%; min-height: 50px; font-size: 17px; }
.sheet .sub { margin-top: 12px; font-size: 13px; }
@media (prefers-reduced-motion: no-preference) {
  .sheet-wrap { animation: fade .2s ease-out both; }
  .sheet { animation: sheet-up .32s cubic-bezier(.22, 1, .36, 1) both; }
}
@keyframes fade { from { opacity: 0; } }
@keyframes sheet-up { from { transform: translateY(100%); } }
.rules { list-style: none; margin: 0 0 12px; padding: 0; }
.rules li { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line-soft); font-size: 15px; color: var(--muted); }
.rules li b { color: var(--text); font-weight: 600; }

/* Hàng nút trong một ca: sát nội dung, nút nhỏ gọn */
.item .actions { margin-top: 8px; gap: 4px; }
.item .actions button.small { min-height: 34px; }
.item .actions .ok { font-size: 13px; }

/* Dashboard chấm công: chỉ số, brand mở ra xem chi tiết */
.income-value.none { color: var(--faint); font-size: 28px; }
.income-warn { margin-top: 8px; color: var(--warn); font-size: 13px; font-weight: 500; }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line-soft); }
.kpi { display: flex; flex-direction: column; gap: 2px; padding: 0 12px; }
.kpi:first-child { padding-left: 0; }
.kpi + .kpi { border-left: 1px solid var(--line-soft); }
.kpi .label { color: var(--muted); font-size: 12px; white-space: nowrap; }
.kpi .value { font-size: 22px; font-weight: 700; letter-spacing: -.03em; line-height: 1.2; font-variant-numeric: tabular-nums; }
.kpi .value small { color: var(--faint); font-size: 13px; font-weight: 400; letter-spacing: 0; }
.brand-head { display: block; width: 100%; min-height: 0; padding: 14px 40px 14px 16px; border: 0; border-radius: 0; background: transparent; color: var(--text); text-align: left; font-weight: 400; white-space: normal; position: relative; }
.brand-head:hover:not(:disabled) { background: transparent; }
.brand-head:active:not(:disabled) { transform: none; background: var(--bg); }
.brand-head::after { content: ''; position: absolute; right: 18px; top: 22px; width: 7px; height: 7px; border-right: 2px solid var(--faint); border-bottom: 2px solid var(--faint); transform: rotate(45deg); transition: transform .2s; }
.brand-row.open .brand-head::after { transform: rotate(-135deg); top: 26px; }
.brand-head .amount { margin-left: auto; flex: none; font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.brand-head .amount.zero { color: var(--faint); font-weight: 400; }
.warn-chip { margin-left: auto; background: color-mix(in srgb, var(--warn) 12%, transparent); color: var(--warn); }
.brand-detail { padding: 2px 16px 16px; }
@media (prefers-reduced-motion: no-preference) { .brand-detail { animation: rise .22s ease-out both; } }
.plat { display: flex; justify-content: space-between; align-items: center; padding: 9px 0; border-top: 1px solid var(--line-soft); font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.plat span:first-child { display: flex; align-items: center; gap: 8px; color: var(--text); }
.plat b { color: var(--text); font-weight: 600; }
.plat i { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.plat i.p-tiktok { background: var(--text); }
.plat i.p-shopee { background: #ee4d2d; }
.brand-detail .rate-edit { margin-top: 4px; padding-top: 12px; flex-wrap: wrap; }
.brand-detail .rate-label { flex-basis: 100%; margin: 0 0 2px; color: var(--muted); font-size: 13px; }
.rate-edit { display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--line-soft); }
.rate-input { flex: 1; display: flex; align-items: center; gap: 6px; min-width: 0; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); transition: border-color .18s, box-shadow .18s; }
.rate-input:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--hover-blue); }
.rate-input input { flex: 1; min-width: 0; min-height: 42px; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }
.rate-input input:focus { box-shadow: none; }
.rate-input span { color: var(--muted); font-size: 13px; }

/* ===== Cài đặt kiểu danh sách iPhone ===== */
.list-head { margin: 28px 0 8px; padding-left: 16px; color: var(--muted); font-size: 13px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; }
#settings .list-head:first-child { margin-top: 12px; }
.list { display: block; background: var(--card); border: 1px solid var(--line-soft); border-radius: 14px; overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; min-height: 50px; padding: 8px 16px; position: relative; }
.row + .row, .list > .row-btn { border-top: 1px solid var(--line-soft); }
.row.inset { padding-left: 58px; min-height: 44px; }
.row-main { flex: 1; min-width: 0; font-size: 16px; }
.row.inset .row-main { color: var(--muted); font-size: 15px; }
.row-value { flex: none; color: var(--muted); font-size: 15px; font-variant-numeric: tabular-nums; }
.row-value.on { color: var(--good); font-weight: 500; }
.row-value button { min-height: 32px; }
.ico { flex: none; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; color: #fff; }
.ico svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ico.red { background: #ff3b30; } .ico.indigo { background: #5856d6; } .ico.blue { background: #0a84ff; } .ico.gray { background: #8e8e93; }
button.row-btn { width: 100%; justify-content: flex-start; border: 0; border-radius: 0; padding: 0 16px 0 58px; min-height: 48px; color: var(--link); font-size: 16px; font-weight: 500; }
button.row-btn:active:not(:disabled) { transform: none; background: var(--bg); }
.list .segmented { flex: 1; }
.list-foot { margin: 8px 16px 0; color: var(--faint); font-size: 13px; line-height: 1.4; }
details.list > summary { list-style: none; cursor: pointer; }
details.list > summary::-webkit-details-marker { display: none; }
.chev { width: 8px; height: 8px; margin-left: 2px; border-right: 2px solid var(--faint); border-bottom: 2px solid var(--faint); transform: rotate(-45deg); transition: transform .2s; }
details[open] .chev { transform: rotate(45deg); }
.adv-form { padding: 14px 16px 16px; border-top: 1px solid var(--line-soft); }
.adv-form label { margin-bottom: 14px; }
.adv-form button { width: 100%; }

/* ===== Khung chờ khi tải ===== */
.skel { height: 14px; margin: 8px 0; border-radius: 7px; background: linear-gradient(90deg, var(--line-soft) 0%, color-mix(in srgb, var(--line-soft) 40%, var(--card)) 50%, var(--line-soft) 100%); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; }
.skel.big { height: 40px; border-radius: 10px; margin: 12px 0; }
.skel.pill { width: 46%; height: 30px; border-radius: 99px; margin-top: 18px; }
.skel.dim { opacity: .6; }
.w40 { width: 40%; } .w55 { width: 55%; } .w70 { width: 70%; } .w100 { width: 100%; }
.skel-hero { margin-top: 16px; padding: 22px 20px; border-radius: 20px; background: var(--card); border: 1px solid var(--line-soft); }
.skel-list { margin-top: 36px; }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skel { animation: none; } }

/* ===== Màn trống ===== */
.empty-box { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-top: 16px; padding: 36px 24px; text-align: center; background: var(--card); border: 1px solid var(--line-soft); border-radius: 20px; }
.empty-ico { width: 56px; height: 56px; display: grid; place-items: center; margin-bottom: 6px; border-radius: 50%; background: var(--hover-blue); color: var(--link); }
.empty-ico svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.empty-box b { font-size: 17px; }
.empty-box p { color: var(--muted); font-size: 14px; }
.empty-box button { margin-top: 10px; }
#records .empty-box { margin-top: 12px; }

/* ===== Cần xác nhận: nút tròn ✓ ===== */
.item.has-check { grid-template-columns: 52px minmax(0, 1fr) 40px; align-items: start; }
.item .check { width: 36px; height: 36px; min-height: 0; padding: 0; margin-top: 2px; border: 1.5px solid var(--line); border-radius: 50%; color: var(--faint); background: transparent; }
.item .check svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.item .check:hover:not(:disabled), .item .check:active:not(:disabled) { border-color: var(--accent); background: var(--accent); color: #fff; }
.item.has-check .hours { display: none; }
.item .skip { margin-left: -10px; color: var(--warn); }

/* ===== Chuyển tab mờ dần ===== */
@media (prefers-reduced-motion: no-preference) {
  main:not([hidden]) { animation: tab-in .28s cubic-bezier(.22, 1, .36, 1) both; }
}
@keyframes tab-in { from { opacity: 0; transform: translateY(6px); } }

/* ================= Liquid Glass =================
   Kính chỉ dùng cho lớp điều khiển nổi (thanh tab, đầu trang, hộp xác nhận, nút trên thẻ xanh),
   nội dung vẫn là thẻ đặc cho dễ đọc, giống cách iOS 26 làm. */
:root {
  --glass-bg: linear-gradient(180deg, rgb(255 255 255 / .62), rgb(255 255 255 / .42));
  --glass-blur: blur(22px) saturate(190%) brightness(1.04);
  --glass-rim: linear-gradient(140deg, rgb(255 255 255 / .95), rgb(255 255 255 / .15) 38%, rgb(255 255 255 / .05) 62%, rgb(255 255 255 / .7));
  --glass-shadow: inset 0 1px 0 rgb(255 255 255 / .85), inset 0 -1px 1px rgb(255 255 255 / .25), 0 10px 30px rgb(0 0 0 / .12), 0 2px 6px rgb(0 0 0 / .06);
}
:root[data-theme="dark"] {
  --glass-bg: linear-gradient(180deg, rgb(60 60 66 / .55), rgb(36 36 40 / .45));
  --glass-blur: blur(22px) saturate(170%) brightness(.95);
  --glass-rim: linear-gradient(140deg, rgb(255 255 255 / .38), rgb(255 255 255 / .06) 40%, rgb(255 255 255 / .02) 60%, rgb(255 255 255 / .22));
  --glass-shadow: inset 0 1px 0 rgb(255 255 255 / .16), 0 10px 30px rgb(0 0 0 / .45);
}
/* Nền có chút màu loang để kính có thứ mà khúc xạ */
body::before { content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(70% 45% at 0% 0%, rgb(10 132 255 / .10), transparent 70%),
              radial-gradient(60% 40% at 100% 35%, rgb(175 82 222 / .08), transparent 70%),
              radial-gradient(70% 45% at 40% 100%, rgb(48 209 88 / .07), transparent 70%); }
[data-theme="dark"] body::before { opacity: .7; }

.glass { background: var(--glass-bg); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur); box-shadow: var(--glass-shadow); border: 0; }
/* Viền sáng như mép kính bắt sáng */
.glass::before, .sheet::before { content: ''; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none;
  background: var(--glass-rim); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; }

/* Thanh tab */
.tabs.glass { background: var(--glass-bg); border: 0; box-shadow: var(--glass-shadow); padding: 6px; transition: width .5s cubic-bezier(.34, 1.4, .64, 1), padding .3s; }
[data-theme="dark"] .tabs.glass { background: var(--glass-bg); box-shadow: var(--glass-shadow); }
.tabs button, .tabs button[aria-current], .tabs button[aria-current]:hover:not(:disabled), [data-theme="dark"] .tabs button[aria-current] { position: relative; z-index: 1; background: transparent; }
.tabs button[aria-current] { color: var(--link); }
[data-theme="dark"] .tabs button[aria-current] { color: #fff; }
.tabs button:active:not(:disabled) { transform: scale(.9); }
.tabs svg { transition: transform .35s cubic-bezier(.34, 1.56, .64, 1); }
.tabs button[aria-current] svg { transform: scale(1.08); }
.tab-glow { position: absolute; z-index: 0; top: 6px; bottom: 6px; left: 6px; width: calc((100% - 12px - 8px) / 3); border-radius: 999px;
  transform: translateX(calc(var(--i, 0) * (100% + 4px))); transition: transform .55s cubic-bezier(.34, 1.45, .64, 1);
  background: linear-gradient(180deg, rgb(0 113 227 / .16), rgb(0 113 227 / .10));
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .9), inset 0 0 0 .5px rgb(0 113 227 / .12), 0 2px 8px rgb(0 113 227 / .12); }
[data-theme="dark"] .tab-glow { background: linear-gradient(180deg, rgb(255 255 255 / .2), rgb(255 255 255 / .1)); box-shadow: inset 0 1px 0 rgb(255 255 255 / .25); }
/* Thu nhỏ khi cuộn xuống */
.tabs.mini { width: min(calc(100% - 32px), 220px); }
.tabs.mini button { min-height: 40px; }
.tabs.mini button span { display: none; }
.tabs.mini svg { width: 22px; height: 22px; }

/* Đầu trang: kính trong, nội dung trôi mờ phía sau */
.top { background: color-mix(in srgb, var(--bg) 62%, transparent); backdrop-filter: blur(24px) saturate(190%); -webkit-backdrop-filter: blur(24px) saturate(190%); border-bottom: 1px solid transparent; transition: border-color .25s, box-shadow .25s; }
.top.scrolled { border-bottom-color: color-mix(in srgb, var(--line) 50%, transparent); box-shadow: 0 1px 12px rgb(0 0 0 / .04); }
.wd.sel .wd-num { box-shadow: inset 0 1px 0 rgb(255 255 255 / .45), 0 3px 10px rgb(0 113 227 / .35); }

/* Hộp xác nhận: tấm kính nổi cách mép, bo tròn lớn */
.sheet-wrap { background: rgb(0 0 0 / .22); }
.sheet { position: relative; width: min(calc(100% - 16px), 520px); margin-bottom: max(8px, env(safe-area-inset-bottom)); padding: 26px 20px 20px; border-radius: 34px;
  background: var(--glass-bg); backdrop-filter: blur(30px) saturate(190%); -webkit-backdrop-filter: blur(30px) saturate(190%); box-shadow: var(--glass-shadow); }
:root:not([data-theme="dark"]) .sheet { background: linear-gradient(180deg, rgb(255 255 255 / .86), rgb(255 255 255 / .74)); }

/* Kéo xuống làm mới: vòng tròn kính */
#ptr { background: var(--glass-bg); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur); box-shadow: var(--glass-shadow); }

/* Nút kính trên thẻ xanh */
.hub-chip, .hero .hero-btn.ghost { background: linear-gradient(180deg, rgb(255 255 255 / .26), rgb(255 255 255 / .12)); backdrop-filter: blur(10px) saturate(160%); -webkit-backdrop-filter: blur(10px) saturate(160%);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .45), inset 0 0 0 .5px rgb(255 255 255 / .25); }
.hero .hero-btn { box-shadow: inset 0 -1px 0 rgb(0 0 0 / .06), 0 4px 14px rgb(0 40 120 / .25); }
/* Bấm vào thì phồng nhẹ rồi bật lại như giọt nước */
.hub-chip, .hero .hero-btn, .item .check, .wd-num { transition: transform .4s cubic-bezier(.34, 1.56, .64, 1), background-color .2s, color .2s; }
.hub-chip:active, .hero .hero-btn:active:not(:disabled), .item .check:active:not(:disabled) { transform: scale(1.07); }
.wd:active .wd-num { transform: scale(1.12); }

/* Chọn giao diện: miếng kính trượt giữa các lựa chọn */
.segmented { position: relative; isolation: isolate; }
.segmented::before { content: ''; position: absolute; z-index: -1; top: 3px; bottom: 3px; left: 3px; width: calc((100% - 6px) / 3); border-radius: 8px;
  background: var(--card); box-shadow: inset 0 1px 0 rgb(255 255 255 / .9), 0 1px 4px rgb(0 0 0 / .14); transition: transform .5s cubic-bezier(.34, 1.45, .64, 1); }
[data-theme="dark"] .segmented::before { background: #4a4b4f; box-shadow: inset 0 1px 0 rgb(255 255 255 / .12); }
.segmented:has(input[value="dark"]:checked)::before { transform: translateX(100%); }
.segmented:has(input[value="auto"]:checked)::before { transform: translateX(200%); }
.segmented label:has(input:checked) { background: transparent; box-shadow: none; }

/* Máy bật "Giảm độ trong suốt" thì dùng nền đặc */
@media (prefers-reduced-transparency: reduce) {
  .glass, .tabs.glass, .sheet, .top, #ptr { background: var(--card); backdrop-filter: none; -webkit-backdrop-filter: none; }
  body::before { display: none; }
}
/* Kính cần thấy nội dung phía sau: chỉ giữ dải mờ mỏng dưới đáy */
body::after { height: calc(20px + env(safe-area-inset-bottom)); }

/* ===== Tiêu đề bấm được để mở lịch tháng ===== */
.top-inner h1 { margin: 0; }
.title-btn { gap: 6px; min-height: 0; padding: 0; border: 0; border-radius: 0; background: transparent; color: var(--text); font: inherit; letter-spacing: inherit; }
.title-btn:hover:not(:disabled) { background: transparent; }
.title-btn:active:not(:disabled) { transform: none; opacity: .6; }
#top-title { font-size: 24px; font-weight: 700; line-height: 1.2; letter-spacing: -.03em; }
.title-chev { width: 8px; height: 8px; margin-top: -4px; border-right: 2.2px solid var(--link); border-bottom: 2.2px solid var(--link); transform: rotate(45deg); transition: transform .35s cubic-bezier(.34, 1.56, .64, 1); }
.month-open .title-chev { transform: translateY(4px) rotate(-135deg); }
.top:not([data-tab="list"]) .title-chev { display: none; }
.top:not([data-tab="list"]) .title-btn { pointer-events: none; }

/* ===== Lịch tháng ===== */
.month-view { max-width: 640px; margin: 0 auto; max-height: min(64vh, 560px); overflow-y: auto; overscroll-behavior: contain; padding: 0 8px 10px; scrollbar-width: none; }
.month-view::-webkit-scrollbar { display: none; }
.top:not([data-tab="list"]) .month-view { display: none; }
.mv-month h3 { margin: 14px 8px 4px; font-size: 20px; font-weight: 700; letter-spacing: -.02em; }
.mv-grid { display: grid; grid-template-columns: repeat(7, 1fr); row-gap: 2px; }
.mv-head { padding: 2px 0 6px; text-align: center; color: var(--faint); font-size: 11px; font-weight: 500; }
.mv-day { flex-direction: column; gap: 2px; min-height: 50px; padding: 2px 0; border: 0; border-radius: 12px; background: transparent; color: var(--text); }
.mv-day:hover:not(:disabled) { background: transparent; }
.mv-num { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; font-size: 17px; font-weight: 500; font-variant-numeric: tabular-nums; transition: transform .4s cubic-bezier(.34, 1.56, .64, 1); }
.mv-day.past .mv-num { color: var(--faint); }
.mv-day.today .mv-num { color: var(--link); font-weight: 700; }
.mv-day.sel .mv-num { background: var(--accent); color: #fff; font-weight: 700; box-shadow: inset 0 1px 0 rgb(255 255 255 / .45), 0 3px 10px rgb(0 113 227 / .35); }
.mv-day:active .mv-num { transform: scale(1.14); }

/* ===== View Transitions: chuyển cảnh mượt ===== */
@media (prefers-reduced-motion: no-preference) {
  .top { view-transition-name: top; }
  .title-btn { view-transition-name: title; }
  .week, .month-view { view-transition-name: cal; }
  .wd.sel .wd-num, .mv-day.sel .mv-num { view-transition-name: sel; }
  main:not([hidden]) { view-transition-name: page; }
  .tabs { view-transition-name: tabs; }
  .tab-glow { view-transition-name: glow; }
}
/* Đang chuyển cảnh: tắt các chuyển động CSS riêng để không chạy chồng */
.vt-run main { animation: none !important; }
.vt-run .tab-glow, .vt-run .tabs svg, .vt-run .title-chev { transition: none !important; }
::view-transition-old(root), ::view-transition-new(root) { animation: none; }
::view-transition-group(*) { animation-duration: .5s; animation-timing-function: cubic-bezier(.32, .72, 0, 1); }
/* Đổi tab: trang cũ lùi ra, trang mới trượt vào theo hướng bấm */
.vt-tab::view-transition-group(page) { animation: none; }
.vt-tab::view-transition-old(page) { animation: .28s cubic-bezier(.32, .72, 0, 1) both vt-page-out; }
.vt-tab::view-transition-new(page) { animation: .46s cubic-bezier(.32, .72, 0, 1) both vt-page-in; }
@keyframes vt-page-out { to { opacity: 0; transform: translateX(calc(var(--dir, 1) * -7%)) scale(.985); } }
@keyframes vt-page-in { from { opacity: 0; transform: translateX(calc(var(--dir, 1) * 9%)); } }
/* Bong bóng kính: trượt có nảy, giãn ra giữa đường như giọt nước */
::view-transition-group(glow) { animation-duration: .56s; animation-timing-function: cubic-bezier(.34, 1.36, .64, 1); }
::view-transition-image-pair(glow) { animation: vt-squish .56s ease-out; }
::view-transition-old(glow) { animation: none; opacity: 0; }
::view-transition-new(glow) { animation: none; }
@keyframes vt-squish { 35% { transform: scale(1.24, .84); } 70% { transform: scale(.96, 1.05); } }
::view-transition-old(title), ::view-transition-new(title) { animation-duration: .3s; height: 100%; object-fit: none; object-position: left center; }
::view-transition-old(tabs), ::view-transition-new(tabs) { animation-duration: .25s; }
/* Mở/thu lịch tháng: khung lịch co giãn, ngày đang chọn bay về đúng chỗ */
.vt-month::view-transition-group(cal) { animation-duration: .52s; overflow: clip; }
.vt-month::view-transition-old(cal) { animation: .22s ease-out both vt-fade-out; height: auto; }
.vt-month::view-transition-new(cal) { animation: .4s .08s ease-out both vt-fade-in; height: auto; }
::view-transition-group(sel) { animation-duration: .52s; animation-timing-function: cubic-bezier(.34, 1.2, .64, 1); z-index: 2; }
@keyframes vt-fade-out { to { opacity: 0; } }
@keyframes vt-fade-in { from { opacity: 0; } }

/* ================= Lược hiệu ứng (bản gọn) =================
   Giữ: kính, chuyển tab mờ nhanh, bong bóng tab trượt, lịch tháng mở/đóng. Bỏ: nảy, phồng, trượt dài. */
.top::after, .top.loading::after { display: none; }
main:not([hidden]) { animation: none; }
.brand-detail, .editor { animation: none !important; }
.tabs svg, .tabs button[aria-current] svg { transform: none; transition: none; }
.tabs button:active:not(:disabled) { transform: scale(.96); }
.hub-chip:active, .hero .hero-btn:active:not(:disabled), .item .check:active:not(:disabled), .wd:active .wd-num, .mv-day:active .mv-num { transform: none; }
.hub-chip, .hero .hero-btn, .item .check, .wd-num, .mv-num { transition: background-color .15s, color .15s; }
.tab-glow { transition: transform .3s cubic-bezier(.25, .8, .25, 1); }
.segmented::before { transition: transform .25s cubic-bezier(.25, .8, .25, 1); }
.title-chev { transition: transform .25s ease; }
.tabs.glass { transition: none; }
/* Chuyển cảnh: ngắn và êm, không trượt ngang, không nảy */
::view-transition-group(*) { animation-duration: .3s; animation-timing-function: cubic-bezier(.25, .8, .25, 1); }
.vt-tab::view-transition-old(page) { animation: .12s ease-out both vt-fade-out; }
.vt-tab::view-transition-new(page) { animation: .2s .04s ease-out both vt-fade-in; }
::view-transition-group(glow) { animation-duration: .3s; animation-timing-function: cubic-bezier(.25, .8, .25, 1); }
::view-transition-image-pair(glow) { animation: none; }
::view-transition-group(sel) { animation-duration: .3s; animation-timing-function: cubic-bezier(.25, .8, .25, 1); }
.vt-month::view-transition-group(cal) { animation-duration: .3s; }
.vt-month::view-transition-old(cal) { animation: .12s ease-out both vt-fade-out; }
.vt-month::view-transition-new(cal) { animation: .22s .05s ease-out both vt-fade-in; }
::view-transition-old(title), ::view-transition-new(title), ::view-transition-old(tabs), ::view-transition-new(tabs) { animation-duration: .18s; }

/* Cài đặt chỉnh chu: công tắc, đường kẻ chừa biểu tượng, chữ trạng thái một kiểu */
#settings .row + .row { border-top: 0; }
#settings .row + .row::before { content: ''; position: absolute; top: 0; right: 0; left: 58px; border-top: .5px solid var(--line); }
#settings .row-value { color: var(--muted); font-weight: 400; }
#settings .row-value.bad { color: #ff3b30; }
#settings label.row { cursor: pointer; margin: 0; font-weight: 400; }
#settings a.row { color: var(--text); text-decoration: none; }
#settings a.row:active, #settings summary.row:active { background: var(--bg); }
.seg-row { padding: 8px; }
.seg-row .segmented { flex: 1; }
.ico.teal { background: #30b0c7; } .ico.green { background: #34c759; }
.switch { -webkit-appearance: none; appearance: none; flex: none; position: relative; width: 51px; height: 31px; margin: 0; padding: 0; border: 0; border-radius: 999px; background: rgb(120 120 128 / .16); cursor: pointer; transition: background-color .25s; }
[data-theme="dark"] .switch { background: rgb(120 120 128 / .32); }
.switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 3px 8px rgb(0 0 0 / .15), 0 1px 1px rgb(0 0 0 / .16); transition: transform .25s cubic-bezier(.25, .8, .25, 1); }
.switch:checked { background: #34c759; }
.switch:checked::after { transform: translateX(20px); }
.switch:disabled { opacity: .6; }
.switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; box-shadow: none; }
/* Biểu tượng tab: nét viền khi thường, tô đặc khi đang chọn */
.tabs svg.on { display: none; }
.tabs button[aria-current] svg.off { display: none; }
.tabs button[aria-current] svg.on { display: block; }

/* Như Instagram: cuộn xuống thì thanh tab thu nhỏ cả khối, cuộn lên thì về cỡ chuẩn. Chỉ dùng transform để mượt */
.tabs.glass { transform-origin: 50% 100%; transition: transform .35s cubic-bezier(.2, .8, .2, 1); will-change: transform; }
.tabs.glass.compact { transform: translateX(-50%) scale(.8); }
.tabs button span { transition: opacity .2s, transform .35s cubic-bezier(.2, .8, .2, 1); }
.tabs button svg { transition: transform .35s cubic-bezier(.2, .8, .2, 1); }
.tabs.compact button span { opacity: 0; transform: translateY(4px); }
.tabs.compact button svg { transform: translateY(7px) scale(1.12); }
@media (prefers-reduced-motion: reduce) { .tabs, .tabs button span, .tabs button svg { transition: none; } }

/* Thanh tab kiểu iOS 26: kính trong hơn, màu trung tính, chữ đen rõ */
.tabs.glass { background: linear-gradient(180deg, rgb(255 255 255 / .38), rgb(255 255 255 / .22)); backdrop-filter: blur(7px) saturate(180%) brightness(1.06); -webkit-backdrop-filter: blur(7px) saturate(180%) brightness(1.06);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .9), inset 0 -1px 1px rgb(255 255 255 / .35), 0 8px 24px rgb(0 0 0 / .10), 0 1px 3px rgb(0 0 0 / .06); }
[data-theme="dark"] .tabs.glass { background: linear-gradient(180deg, rgb(40 40 44 / .42), rgb(20 20 24 / .30)); backdrop-filter: blur(7px) saturate(160%) brightness(.9); -webkit-backdrop-filter: blur(7px) saturate(160%) brightness(.9);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .18), 0 8px 24px rgb(0 0 0 / .4); }
.tabs.glass button, .tabs.glass button[aria-current], .tabs.glass button:hover:not(:disabled) { color: #111; font-size: 12px; font-weight: 600; text-shadow: 0 0 6px rgb(255 255 255 / .7); }
[data-theme="dark"] .tabs.glass button, [data-theme="dark"] .tabs.glass button[aria-current] { color: #fff; text-shadow: 0 0 6px rgb(0 0 0 / .5); }
.tabs.glass svg { stroke-width: 1.9; }
.tab-glow, [data-theme="dark"] .tab-glow { background: rgb(120 120 128 / .18); box-shadow: inset 0 1px 0 rgb(255 255 255 / .5); }
[data-theme="dark"] .tab-glow { background: rgb(255 255 255 / .16); box-shadow: inset 0 1px 0 rgb(255 255 255 / .18); }

/* ===== Mượt hơn trên iPhone =====
   Kính (làm nhòe nền) chỉ để ở 2 lớp đứng yên: đầu trang và thanh tab. Thứ nằm trong nội dung đang cuộn
   mà làm nhòe nền thì máy phải tính lại mỗi khung hình, nên đổi sang nền trong mờ thường. */
.hub-chip, .hero .hero-btn.ghost { backdrop-filter: none; -webkit-backdrop-filter: none; background: rgb(255 255 255 / .2); }
.top { backdrop-filter: blur(16px) saturate(180%); -webkit-backdrop-filter: blur(16px) saturate(180%); }
/* Chuyển tab và mở lịch tháng: chỉ mờ dần, chạy trên GPU */
main:not([hidden]) { animation: tab-fade .18s ease-out both; }
.month-view:not([hidden]) { animation: tab-fade .2s ease-out both; }
@keyframes tab-fade { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { main:not([hidden]), .month-view:not([hidden]) { animation: none; } }

/* Ảnh bảng công */
.slip-bar { display: flex; align-items: center; gap: 12px; margin-top: 12px; padding: 12px 14px; background: var(--card); border: 1px solid var(--line-soft); border-radius: 14px; }
.slip-bar[hidden] { display: none; }
.slip-ico { flex: none; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; background: #0071e3; color: #fff; }
.slip-ico svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.slip-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.slip-text b { font-size: 15px; font-weight: 600; }
.slip-text small { color: var(--muted); font-size: 12px; }
.slip-bar button { min-height: 34px; padding: 0 14px; }
.slip-sheet { max-height: 92dvh; display: flex; flex-direction: column; }
.slip-img { flex: 1; min-height: 0; overflow: auto; margin: 14px 0 4px; border-radius: 10px; background: #f1f3f5; -webkit-touch-callout: default; }
.slip-img img { display: block; width: 100%; height: auto; }
.slip-sheet button { margin-top: 12px; }
.slip-sheet { background: var(--card); backdrop-filter: none; -webkit-backdrop-filter: none; }
#slip { z-index: 60; }
