/* Lịch làm việc – giao diện theo phong cách ứng dụng Lịch của iPhone */
:root {
  --nen: #ffffff; --nen2: #f2f2f7; --the: #ffffff; --nav: rgba(249, 249, 249, .94);
  --chu: #000000; --chu2: #8e8e93; --chu3: #c7c7cc; --vach: rgba(60, 60, 67, .2);
  --do: #ff3b30; --xanh: #007aff; --xam-bong: #e9e9eb;
  --c-sep: #ff9500; --c-troly: #007aff; --c-chung: #34c759;
  --bong: 0 10px 40px rgba(0, 0, 0, .18);
  --app-h: 100vh;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --nen: #000000; --nen2: #000000; --the: #1c1c1e; --nav: rgba(22, 22, 22, .94);
    --chu: #ffffff; --chu2: #8e8e93; --chu3: #48484a; --vach: rgba(84, 84, 88, .6);
    --do: #ff453a; --xanh: #0a84ff; --xam-bong: #26252a;
    --c-sep: #ff9f0a; --c-troly: #0a84ff; --c-chung: #30d158;
  }
}
:root[data-theme="dark"] {
  --nen: #000000; --nen2: #000000; --the: #1c1c1e; --nav: rgba(22, 22, 22, .94);
  --chu: #ffffff; --chu2: #8e8e93; --chu3: #48484a; --vach: rgba(84, 84, 88, .6);
  --do: #ff453a; --xanh: #0a84ff; --xam-bong: #26252a;
  --c-sep: #ff9f0a; --c-troly: #0a84ff; --c-chung: #30d158;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--nen); }
body {
  font: 17px/1.3 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--chu); -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
[hidden] { display: none !important; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
h1 { font-size: 30px; font-weight: 700; letter-spacing: -.02em; margin: 0; }
code { font-size: .85em; background: var(--nen2); padding: 1px 5px; border-radius: 5px; word-break: break-all; }
.do { color: var(--do) !important; }
.mo { color: var(--chu2); margin: 6px 0 0; }
:focus-visible { outline: 2px solid var(--xanh); outline-offset: 2px; }

#app { position: fixed; inset: 0; height: var(--app-h); display: flex; flex-direction: column; }
.man { flex: 1; min-height: 0; }

/* màu các lịch */
.c-sep { background: var(--c-sep); } .c-troly { background: var(--c-troly); } .c-chung { background: var(--c-chung); }
.c-sep-bg { background: var(--c-sep) !important; } .c-troly-bg { background: var(--c-troly) !important; }
.cham { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; vertical-align: 0; }

/* ===== màn chờ / đăng nhập / thiết lập ===== */
.man-giua { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px 16px; overflow-y: auto; }
.man-giua h1 { font-size: 24px; margin-top: 18px; }
.logo-to {
  width: 88px; height: 88px; border-radius: 20px; background: var(--the); box-shadow: 0 4px 18px rgba(0, 0, 0, .12);
  display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1;
}
.logo-to span { color: var(--do); font-size: 13px; font-weight: 600; letter-spacing: .04em; }
.logo-to b { font-size: 44px; font-weight: 300; margin-top: 2px; }
.logo-to.nho { width: 72px; height: 72px; border-radius: 17px; }
.logo-to.nho b { font-size: 36px; }
.buoc { text-align: left; max-width: 420px; color: var(--chu2); font-size: 15px; padding-left: 22px; line-height: 1.5; }

.man-form { overflow-y: auto; background: var(--nen2); padding: calc(env(safe-area-inset-top) + 40px) 16px calc(env(safe-area-inset-bottom) + 30px); }
.man-form form { max-width: 460px; margin: 0 auto; }
.form-dau { text-align: center; display: flex; flex-direction: column; align-items: center; margin-bottom: 26px; }
.form-dau h1 { font-size: 26px; margin-top: 16px; }
.nut-chinh {
  display: block; width: 100%; margin-top: 22px; padding: 15px; border-radius: 14px; background: var(--xanh); color: #fff;
  font-weight: 600; font-size: 17px;
}
.nut-chinh:disabled { opacity: .5; }
.loi { color: var(--do); text-align: center; font-size: 15px; min-height: 20px; margin: 12px 0 0; }

.chon-vai { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 22px; }
.chon-vai input { position: absolute; opacity: 0; pointer-events: none; }
.the-vai {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 18px 8px; border-radius: 16px; background: var(--the);
  border: 2px solid transparent; cursor: pointer; text-align: center; transition: border-color .15s, transform .15s;
}
.the-vai b { font-size: 16px; word-break: break-word; }
.the-vai small { color: var(--chu2); font-size: 13px; }
.chon-vai input:checked + .the-vai { border-color: var(--xanh); }
.chon-vai input:focus-visible + .the-vai { outline: 2px solid var(--xanh); }
.ava {
  width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(#a5abb8, #858994); color: #fff; font-style: normal;
  display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: 16px; flex: none;
}
.the-vai .ava, .ava.to { width: 56px; height: 56px; font-size: 24px; }

/* nhóm dòng kiểu iOS */
.nhom-ten { margin: 22px 16px 7px; font-size: 13px; color: var(--chu2); text-transform: uppercase; letter-spacing: .02em; }
.nhom { background: var(--the); border-radius: 12px; overflow: hidden; margin-bottom: 14px; }
.dong {
  display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 6px 16px; position: relative; width: 100%; text-align: left;
}
.dong + .dong::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: .5px solid var(--vach); }
.dong > span:first-child { flex: none; }
.dong input, .dong select, .dong textarea {
  flex: 1; min-width: 0; border: 0; background: none; outline: none; text-align: right; padding: 6px 0; color: var(--chu);
}
.dong input::placeholder, .dong textarea::placeholder { color: var(--chu3); }
.dong.cot { flex-direction: column; align-items: stretch; }
.dong.cot input, .dong textarea { text-align: left; }
.dong textarea { resize: none; min-height: 90px; }
.nut-dong { justify-content: space-between; }
.nut-dong.do { justify-content: center; }
.mui { color: var(--chu3); font-style: normal; font-size: 22px; }
.chu-thich { font-size: 13px; color: var(--chu2); margin: -6px 16px 10px; line-height: 1.4; }
.chu-thich.giua { text-align: center; margin-top: 20px; }

/* ===== khung ứng dụng ===== */
#man-chinh { display: flex; flex-direction: column; position: relative; }
.tab { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; position: relative; overscroll-behavior-y: contain; }
#mat-mang {
  position: absolute; top: env(safe-area-inset-top); left: 50%; transform: translateX(-50%); z-index: 30; margin-top: 6px;
  background: rgba(60, 60, 67, .85); color: #fff; font-size: 13px; padding: 5px 12px; border-radius: 20px; white-space: nowrap;
}

.nav {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between;
  min-height: 44px; padding: calc(env(safe-area-inset-top) + 6px) 12px 6px;
  background: var(--nav); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
}
.nav-to { padding-left: 16px; padding-right: 12px; border-bottom: .5px solid var(--vach); }
.nav-to h1 { font-size: 28px; }
.nav-lui { display: flex; align-items: center; gap: 4px; color: var(--do); font-size: 17px; padding: 6px 4px; }
.nav-lui svg { width: 12px; height: 20px; stroke-width: 2.6; }
.nav-phai { display: flex; align-items: center; gap: 4px; }
.nut-chu { color: var(--do); padding: 8px 10px; font-size: 17px; }
.nut-icon { color: var(--do); width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; }
.nut-icon svg { width: 24px; height: 24px; }
.nut-icon:active, .nut-chu:active, .nav-lui:active { opacity: .4; }

/* ===== tháng ===== */
.tieu-de-thang { display: flex; align-items: flex-end; justify-content: space-between; padding: 2px 16px 8px; }
.tieu-de-thang h1 { font-size: 30px; }
.mui-ten button { color: var(--do); font-size: 30px; width: 40px; height: 36px; line-height: 1; border-radius: 10px; }
.mui-ten button:active { background: var(--nen2); }
.hang-thu {
  display: grid; grid-template-columns: repeat(7, 1fr); font-size: 12px; color: var(--chu); text-align: center; padding: 4px 4px 6px;
  border-bottom: .5px solid var(--vach);
}
.hang-thu .cuoi-tuan, .o-ngay.cuoi-tuan .so { color: var(--chu2); }
.luoi-thang { display: grid; grid-template-columns: repeat(7, 1fr); padding: 0 4px; touch-action: pan-y; }
.luoi-thang.truot-trai { animation: truotTrai .25s ease; } .luoi-thang.truot-phai { animation: truotPhai .25s ease; }
@keyframes truotTrai { from { transform: translateX(40px); opacity: 0; } }
@keyframes truotPhai { from { transform: translateX(-40px); opacity: 0; } }
.o-ngay {
  height: 54px; display: flex; flex-direction: column; align-items: center; padding-top: 6px; gap: 3px;
  border-top: .5px solid var(--vach); position: relative;
}
.o-ngay:nth-child(-n+7) { border-top: 0; }
.o-ngay.trong { pointer-events: none; }
.o-ngay .so {
  width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 19px;
}
.o-ngay.hom-nay .so { color: var(--do); font-weight: 600; }
.o-ngay.dang-chon .so { background: var(--chu); color: var(--nen); font-weight: 600; }
.o-ngay.dang-chon.hom-nay .so { background: var(--do); color: #fff; }
.o-ngay .cham-ngay { display: flex; gap: 3px; height: 6px; }
.o-ngay .cham-ngay i { width: 6px; height: 6px; border-radius: 50%; }

.ds-ngay { border-top: .5px solid var(--vach); padding: 0 0 24px; min-height: 200px; }
.ngay-dau { padding: 12px 16px 6px; font-size: 15px; font-weight: 600; color: var(--chu); }
.ngay-dau small { color: var(--chu2); font-weight: 400; }
.trong-rong { color: var(--chu2); text-align: center; padding: 26px 16px; font-size: 15px; }

.su-kien {
  display: flex; align-items: stretch; gap: 10px; padding: 10px 16px; width: 100%; text-align: left; position: relative;
}
.su-kien + .su-kien::before { content: ""; position: absolute; top: 0; left: 82px; right: 0; border-top: .5px solid var(--vach); }
.su-kien:active { background: var(--nen2); }
.su-kien .gio { width: 56px; flex: none; font-size: 14px; text-align: right; line-height: 1.35; }
.su-kien .gio small { display: block; color: var(--chu2); font-size: 13px; }
.su-kien .vach-mau { width: 4px; border-radius: 2px; flex: none; }
.su-kien .nd { flex: 1; min-width: 0; }
.su-kien .nd b { display: block; font-weight: 600; font-size: 16px; overflow: hidden; text-overflow: ellipsis; }
.su-kien .nd small { display: block; color: var(--chu2); font-size: 14px; margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nut-hom-nay {
  position: sticky; bottom: 12px; margin: 8px 0 12px 16px; display: block; width: max-content; z-index: 6;
  background: var(--the); color: var(--do); padding: 9px 16px; border-radius: 20px; font-size: 16px; box-shadow: 0 2px 12px rgba(0, 0, 0, .15);
}

/* ===== năm ===== */
.luoi-nam { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px 14px; padding: 6px 16px 40px; }
.thang-nho { text-align: left; border-radius: 8px; padding: 2px; align-self: start; display: flex; flex-direction: column; }
.thang-nho:active { background: var(--nen2); }
.thang-nho h3 { font-size: 17px; margin: 0 0 4px 2px; color: var(--do); font-weight: 600; }
.thang-nho .luoi { display: grid; grid-template-columns: repeat(7, 1fr); font-size: 9px; text-align: center; row-gap: 2px; }
.thang-nho .luoi i { font-style: normal; height: 13px; line-height: 13px; border-radius: 50%; }
.thang-nho .luoi i.co { font-weight: 700; color: var(--chu); }
.thang-nho .luoi i.nhat { color: var(--chu2); }
.thang-nho .luoi i.hn { background: var(--do); color: #fff; font-weight: 700; }

.goi-y {
  position: sticky; bottom: 62px; margin: 8px 12px 0; z-index: 7; display: flex; flex-direction: column; gap: 3px;
  background: var(--the); border-radius: 14px; box-shadow: var(--bong); padding: 12px 40px 12px 14px; font-size: 14px;
}
.goi-y span { color: var(--chu2); }
.goi-y svg { width: 16px; height: 16px; vertical-align: -3px; color: var(--xanh); }
.dong-goi-y { position: absolute; top: 6px; right: 6px; width: 30px; height: 30px; font-size: 22px; color: var(--chu2); }

/* ===== sắp tới ===== */
.o-tim { display: flex; align-items: center; gap: 6px; margin: 10px 16px; background: var(--xam-bong); border-radius: 10px; padding: 0 10px; color: var(--chu2); }
.o-tim svg { width: 18px; height: 18px; flex: none; }
.o-tim input { flex: 1; border: 0; background: none; outline: none; padding: 9px 0; color: var(--chu); min-width: 0; }
.ds-saptoi { padding-bottom: 40px; }
.ds-saptoi .ngay-dau { position: sticky; top: calc(env(safe-area-inset-top) + 52px); background: var(--nav); z-index: 4; border-bottom: .5px solid var(--vach); }
.ds-saptoi .ngay-dau.hn { color: var(--do); }

/* ===== tin nhắn ===== */
#tab-chat { display: flex; flex-direction: column; overflow: hidden; }
.nav-chat { justify-content: flex-start; gap: 10px; border-bottom: .5px solid var(--vach); padding-left: 16px; }
.nav-chat b { display: block; font-size: 17px; }
.nav-chat small { display: block; font-size: 12px; color: var(--chu2); min-height: 15px; }
.nav-chat small.on { color: var(--c-chung); }
.ds-tin { flex: 1; overflow-y: auto; padding: 10px 12px 6px; display: flex; flex-direction: column; -webkit-overflow-scrolling: touch; overscroll-behavior-y: contain; }
.moc-gio { text-align: center; font-size: 12px; color: var(--chu2); margin: 14px 0 6px; }
.moc-gio b { font-weight: 600; }
.bong { max-width: 78%; padding: 8px 13px; border-radius: 19px; font-size: 16px; line-height: 1.32; margin-top: 2px; white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere; }
.bong.cua-toi { align-self: flex-end; background: var(--xanh); color: #fff; }
.bong.cua-ho { align-self: flex-start; background: var(--xam-bong); color: var(--chu); }
.bong.cuoi.cua-toi { border-bottom-right-radius: 6px; } .bong.cuoi.cua-ho { border-bottom-left-radius: 6px; }
.bong.dang-gui { opacity: .6; }
.bong a { color: inherit; }
.the-lich {
  display: flex; gap: 10px; text-align: left; width: 100%; background: var(--the); color: var(--chu); border-radius: 12px; padding: 9px 10px;
  margin: 2px 0; min-width: 210px;
}
.bong.cua-toi .the-lich { box-shadow: none; }
.the-lich .vach-mau { width: 4px; border-radius: 2px; flex: none; }
.the-lich b { display: block; font-size: 15px; }
.the-lich small { display: block; font-size: 13px; color: var(--chu2); }
.trang-thai-tin { align-self: flex-end; font-size: 11px; color: var(--chu2); margin: 2px 4px 0; }
.trang-thai-tin.loi-gui { color: var(--do); cursor: pointer; }
.soan-tin {
  display: flex; align-items: flex-end; gap: 8px; padding: 8px 10px;
  border-top: .5px solid var(--vach); background: var(--nav);
}
.soan-tin textarea {
  flex: 1; resize: none; border: .5px solid var(--vach); border-radius: 19px; padding: 8px 14px; max-height: 130px;
  background: var(--nen); outline: none; line-height: 1.3; font-size: 16px;
}
.nut-tron { width: 36px; height: 36px; border-radius: 50%; color: var(--chu2); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.nut-gui { width: 34px; height: 34px; border-radius: 50%; background: var(--xanh); color: #fff; display: inline-flex; align-items: center; justify-content: center; flex: none; margin-bottom: 2px; }
.nut-gui:disabled { background: var(--chu3); }
.nut-gui svg { width: 20px; height: 20px; stroke-width: 2.6; }

/* ===== danh sách cuộc trò chuyện ===== */
.chat-ds-khung { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.chat-phong { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.chat-ds { padding-bottom: 20px; }
.dong-chat { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 10px 16px; position: relative; }
.dong-chat + .dong-chat::before { content: ""; position: absolute; top: 0; left: 76px; right: 0; border-top: .5px solid var(--vach); }
.dong-chat:active { background: var(--nen2); }
.dong-chat .ava { width: 48px; height: 48px; font-size: 20px; }
.ava-nhom { background: linear-gradient(#5ac8fa, #007aff) !important; }
.ava-nhom svg { width: 60%; height: 60%; color: #fff; stroke-width: 1.8; }
.nav-chat .ava { width: 36px; height: 36px; font-size: 16px; }
.dc-nd { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.dc-hang { display: flex; align-items: center; gap: 8px; min-width: 0; }
.dc-hang b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16px; }
.dc-hang small { color: var(--chu2); font-size: 13px; flex: none; }
.dc-xem { flex: 1; min-width: 0; color: var(--chu2); font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dong-chat.chua-doc .dc-xem { color: var(--chu); font-weight: 600; }
.dc-phu { color: var(--chu2); font-size: 13px; }
.huy-hieu-nho { flex: none; min-width: 20px; height: 20px; border-radius: 10px; background: var(--xanh); color: #fff; font-style: normal; font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; padding: 0 6px; }
.ten-gui { font-size: 12px; font-weight: 600; margin: 8px 0 1px 12px; }
.nav-chat .nav-lui { margin-left: -8px; }

/* ===== quản lý thành viên ===== */
#tab-thanhvien { background: var(--nen2); }
#tab-thanhvien .nav-to { background: var(--nav); }
.the-tv { gap: 12px; }
.the-tv .ava { width: 40px; height: 40px; font-size: 17px; }
.tv-nd { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tv-nd b { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tv-nd small { color: var(--chu2); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tv-nd em { font-style: normal; }
.chon-mau { display: flex; flex-wrap: wrap; gap: 10px; padding: 12px 14px; }
.chon-mau label { position: relative; cursor: pointer; }
.chon-mau input { position: absolute; opacity: 0; }
.chon-mau i { display: block; width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--the); box-shadow: 0 0 0 1px var(--vach); }
.chon-mau input:checked + i { box-shadow: 0 0 0 2.5px var(--chu); }
.chon-mau input:focus-visible + i { outline: 2px solid var(--xanh); outline-offset: 3px; }
.chu-ma { font-family: ui-monospace, Menlo, monospace; color: var(--chu) !important; font-size: 17px; user-select: all; }

/* ===== cài đặt ===== */
#tab-toi { background: var(--nen2); }
#tab-toi .nav-to { background: var(--nav); }
.cai-dat { padding: 16px 16px 40px; max-width: 640px; margin: 0 auto; }
.the-toi { display: flex; align-items: center; gap: 14px; padding: 14px 16px; }
.the-toi b { display: block; font-size: 20px; } .the-toi small { color: var(--chu2); font-size: 14px; }
.tt-tb { font-size: 15px; color: var(--chu2); padding: 12px 16px; line-height: 1.45; }
.tt-tb b { color: var(--chu); }
.tt-tb ol { margin: 6px 0 0; padding-left: 20px; }
.nut-dong.xanh { color: var(--xanh); justify-content: center; font-weight: 600; }

/* ===== thanh tab ===== */
.tabbar {
  display: grid; grid-template-columns: repeat(4, 1fr); border-top: .5px solid var(--vach); background: var(--nav);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  padding: 6px 0 max(6px, env(safe-area-inset-bottom)); flex: none;
}
.tabbar button { display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--chu2); font-size: 10.5px; font-weight: 500; position: relative; padding: 2px 0; }
.tabbar svg { width: 26px; height: 26px; stroke-width: 1.8; }
.tabbar .dang-chon { color: var(--do); }
.huy-hieu {
  position: absolute; top: -2px; left: calc(50% + 6px); min-width: 18px; height: 18px; border-radius: 9px; background: var(--do); color: #fff;
  font-size: 12px; font-style: normal; font-weight: 600; display: flex; align-items: center; justify-content: center; padding: 0 5px;
}
.ban-phim-mo .tabbar, .ban-phim-mo .thanh-demo { display: none; }
.thanh-demo { display: flex; align-items: center; gap: 10px; padding: 6px 12px; font-size: 13px; background: #fff4d6; color: #6b4e00; flex: none; }
.thanh-demo span { flex: 1; min-width: 0; }
.thanh-demo button { color: var(--xanh); font-weight: 600; font-size: 13px; padding: 4px 0; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .thanh-demo { background: #3a2f10; color: #ffd66b; } }

/* ===== bảng trượt ===== */
.sheet-nen { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .35); display: flex; align-items: flex-end; justify-content: center; animation: hien .2s; }
.sheet {
  width: 100%; max-width: 640px; max-height: calc(var(--app-h) - env(safe-area-inset-top) - 12px); overflow-y: auto; overscroll-behavior: contain;
  background: var(--nen2); border-radius: 14px 14px 0 0; animation: truotLen .28s cubic-bezier(.2, .8, .2, 1);
  padding-bottom: max(16px, env(safe-area-inset-bottom));
}
.sheet-nen.dong-lai { animation: an .2s forwards; } .sheet-nen.dong-lai .sheet { animation: truotXuong .2s forwards; }
@keyframes hien { from { background: rgba(0, 0, 0, 0); } }
@keyframes an { to { background: rgba(0, 0, 0, 0); } }
@keyframes truotLen { from { transform: translateY(100%); } }
@keyframes truotXuong { to { transform: translateY(100%); } }
.sheet-dau {
  position: sticky; top: 0; z-index: 2; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 14px 16px 12px;
  background: var(--nen2);
}
.sheet-dau b { font-size: 17px; text-align: center; }
.sheet-dau button { color: var(--do); font-size: 17px; padding: 4px 0; }
.sheet-dau button:first-child { justify-self: start; }
.sheet-dau button:last-child { justify-self: end; font-weight: 600; }
.sheet-dau button:disabled { color: var(--chu3); }
.sheet-than { padding: 4px 16px 10px; }

.cong-tac { position: relative; width: 51px; height: 31px; flex: none; margin-left: auto; }
.cong-tac input { opacity: 0; position: absolute; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.cong-tac i { position: absolute; inset: 0; border-radius: 16px; background: var(--chu3); transition: background .2s; }
.cong-tac i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, .2); transition: transform .2s; }
.cong-tac input:checked + i { background: #34c759; }
.cong-tac input:checked + i::after { transform: translateX(20px); }
.cong-tac input:focus-visible + i { outline: 2px solid var(--xanh); outline-offset: 2px; }
.ngay-gio { display: flex; gap: 6px; margin-left: auto; min-width: 0; justify-content: flex-end; }
.ngay-gio input { flex: 0 1 auto; text-align: center; background: var(--xam-bong); border-radius: 7px; padding: 6px 8px; min-width: 0; }
.ngay-gio input[type="date"] { width: 128px; } .ngay-gio input[type="time"] { width: 72px; }
.dong input::-webkit-calendar-picker-indicator { display: none; }
.dong input[type="date"], .dong input[type="time"] { cursor: pointer; }
.dong select { appearance: none; -webkit-appearance: none; flex: 0 1 auto; margin-left: auto; max-width: 66%; text-align: right; color: var(--chu2); padding-right: 2px; }

.chon-lich { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 6px; padding: 8px; }
.chon-lich input { position: absolute; opacity: 0; pointer-events: none; }
.chon-lich span { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 6px; border-radius: 9px; font-size: 15px; border: 1.5px solid transparent; cursor: pointer; min-width: 0; }
.chon-lich span b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chon-lich input:checked + span { border-color: currentColor; font-weight: 600; background: var(--nen2); }
.chon-lich input:focus-visible + span { outline: 2px solid var(--xanh); }
.chon-lich .cham { margin: 0; }

.ct-tieu-de { font-size: 24px; font-weight: 700; margin: 6px 0 2px; word-break: break-word; }
.ct-dong { color: var(--chu2); font-size: 16px; margin: 2px 0; }
.ct-dong.dia-diem { color: var(--chu); }
.ct-chu { white-space: pre-wrap; word-wrap: break-word; padding: 12px 16px; font-size: 16px; }
.ct-chu a { color: var(--xanh); }
.ct-meta { font-size: 13px; color: var(--chu2); text-align: center; margin: 10px 0 16px; }
.dong .gia-tri { margin-left: auto; color: var(--chu2); display: flex; align-items: center; gap: 6px; text-align: right; }
.nut-xoa { color: var(--do); justify-content: center; }
.dau-tich { margin-left: auto; color: var(--do); font-weight: 700; }

/* ===== danh sách sắp tới dưới lịch ===== */
.tieu-de-ds { display: flex; align-items: center; justify-content: space-between; padding: 16px 12px 4px 16px; }
.tieu-de-ds h2 { font-size: 22px; font-weight: 700; margin: 0; letter-spacing: -.01em; }
.ngay-dau.hn { color: var(--do); }
.trong-rong.nho { padding: 6px 16px 14px; text-align: left; }
#khung-tim { margin: 12px 16px 0; }

/* ===== nhập lịch trình ===== */
#tab-nhap { background: var(--nen2); }
#tab-nhap .nav-to { background: var(--nav); }
#khung-nhap { padding-top: 4px; }
.chon-so { display: flex; gap: 6px; margin-left: auto; flex-wrap: wrap; justify-content: flex-end; }
.dong .chon-so select {
  flex: none; max-width: none; margin: 0; direction: ltr; text-align: center; color: var(--chu);
  background: var(--xam-bong); border-radius: 8px; padding: 7px 10px; font-size: 16px;
}
.dong .chon-so select[hidden] { display: none; }
#khung-nhap textarea, #form-sk textarea { min-height: 110px; font-size: 16px; }
.tuy-chon summary { list-style: none; color: var(--xanh); cursor: pointer; font-size: 15px; }
.tuy-chon summary::-webkit-details-marker { display: none; }
.tuy-chon summary::after { content: "›"; margin-left: auto; font-size: 20px; color: var(--chu3); transition: transform .2s; }
.tuy-chon[open] summary::after { transform: rotate(90deg); }
.tuy-chon .dong input[type="date"] { flex: 0 1 auto; background: var(--xam-bong); border-radius: 8px; padding: 6px 10px; text-align: center; }
.nut-phu { display: block; width: 100%; margin: 6px 0 30px; padding: 14px; color: var(--xanh); font-size: 16px; font-weight: 600; }

/* ===== nhập nhiều lịch ===== */
.dan-nhanh textarea { width: 100%; min-height: 120px; border: 0; outline: none; background: none; resize: vertical; padding: 12px 16px; font-size: 15px; line-height: 1.45; color: var(--chu); }
.dan-nhanh textarea::placeholder { color: var(--chu3); }
.dan-nhanh .nut-dong { border-top: .5px solid var(--vach); }
.mac-dinh { display: grid; grid-template-columns: 1fr; }
.dong-nhap { background: var(--the); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; border: 1.5px solid transparent; }
.dong-nhap.loi-dong { border-color: var(--do); }
.dong-nhap input, .dong-nhap select { width: 100%; border: 0; outline: none; background: var(--xam-bong); border-radius: 8px; padding: 8px 10px; font-size: 16px; min-width: 0; color: var(--chu); }
.dong-nhap input::placeholder { color: var(--chu2); }
.dong-nhap input::-webkit-calendar-picker-indicator { display: none; }
.dn-hang1 { display: flex; align-items: center; gap: 6px; }
.dn-hang1 .dn-so { width: 22px; flex: none; font-size: 13px; color: var(--chu2); font-weight: 600; }
.dn-hang1 input[type="date"] { flex: 1 1 0; }
.dn-hang3 input[type="time"] { flex: 0 0 78px; width: 78px; text-align: center; padding-left: 4px; padding-right: 4px; }
.dn-hang1 .gach { color: var(--chu2); }
.dn-xoa { width: 30px; height: 30px; flex: none; border-radius: 50%; color: var(--chu2); font-size: 22px; line-height: 1; }
.dn-xoa:active { background: var(--nen2); }
.dong-nhap input[name="tieuDe"] { font-weight: 600; }
.dn-hang3 { display: flex; gap: 6px; align-items: center; }
.dn-hang3 select { flex: 1 1 0; min-width: 0; appearance: none; -webkit-appearance: none; text-align: center; }
.dn-cn { display: flex; align-items: center; gap: 4px; font-size: 13px; color: var(--chu2); flex: none; white-space: nowrap; }
.dn-cn input { width: 18px; height: 18px; flex: none; padding: 0; accent-color: var(--c-chung); }
.dong-nhap.ca-ngay input[type="time"], .dong-nhap.ca-ngay .gach { display: none; }
.nut-them-dong { display: block; width: 100%; padding: 13px; border-radius: 12px; border: 1.5px dashed var(--chu3); color: var(--xanh); font-weight: 600; margin-bottom: 14px; }

#toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 90px); transform: translate(-50%, 20px); z-index: 80;
  background: rgba(30, 30, 30, .92); color: #fff; padding: 10px 18px; border-radius: 22px; font-size: 15px; max-width: calc(100% - 32px);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; text-align: center;
}
#toast.hien { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 700px) {
  .tab > *:not(.nav):not(.nut-hom-nay):not(.goi-y) { max-width: 720px; margin-left: auto; margin-right: auto; }
  .o-ngay { height: 72px; }
  .sheet { border-radius: 14px; margin-bottom: 5vh; }
  .sheet-nen { align-items: center; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; }
}
