:root {
  --pink: #f7549b;
  --pink-deep: #e03a84;
  --pink-ink: #8a1d52;
  --pink-soft: #ffe3ef;
  --pink-bg1: #ff8fc0;
  --pink-bg2: #ffc2dc;
  --ink: #4a2338;
  --muted: #9b6b83;
  --line: #f6d3e3;
  --card: #ffffff;
  --d1: #fcd3e6; --d1i: #b02a6b;
  --d2: #fde0c6; --d2i: #a65a1c;
  --d3: #fdf1b3; --d3i: #8a6d00;
  --d4: #cfeed3; --d4i: #2f7a3c;
  --d5: #c5e4f8; --d5i: #1f6a9c;
  --d6: #e0d9f7; --d6i: #5b46a8;
  --st-proposed: #fff3bf; --st-proposed-i: #8a6a00;
  --st-saved: #d3f2dc; --st-saved-i: #1e7a3c;
  --st-done: #e3ecef; --st-done-i: #4f6b75;
  --st-skip: #ffe0e0; --st-skip-i: #b33b3b;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(214, 45, 120, .18);
}
* { box-sizing: border-box; }
html { background: var(--pink-bg1); }
body {
  margin: 0; min-height: 100vh; color: var(--ink);
  font-family: 'Nunito', system-ui, sans-serif; font-weight: 600;
  background:
    radial-gradient(ellipse 60% 40% at 10% 100%, #fff 0 30%, transparent 70%),
    radial-gradient(ellipse 50% 35% at 90% 100%, #fff 0 25%, transparent 70%),
    radial-gradient(ellipse 45% 30% at 95% 20%, rgba(255,255,255,.75) 0 30%, transparent 70%),
    radial-gradient(ellipse 45% 30% at 0% 30%, rgba(255,255,255,.6) 0 25%, transparent 70%),
    linear-gradient(180deg, var(--pink-bg1) 0%, var(--pink-bg2) 55%, #ffd9ea 100%);
  background-attachment: fixed;
}
button, input, select, textarea { font: inherit; color: inherit; }

/* nền trang trí */
.sky { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.sky .h { position: absolute; color: #ff3d8b; text-shadow: 0 4px 10px rgba(255,61,139,.35); font-size: 34px; }
.h1 { left: 3%; top: 32%; transform: rotate(-15deg); } .h2 { right: 4%; top: 12%; font-size: 26px !important; }
.h3 { left: 6%; bottom: 8%; font-size: 40px !important; } .h4 { right: 6%; bottom: 10%; transform: rotate(12deg); }
.sky .s { position: absolute; color: #fff; font-size: 22px; opacity: .9; }
.s1 { left: 22%; top: 8%; } .s2 { left: 48%; top: 3%; font-size: 14px !important; } .s3 { right: 22%; top: 30%; } .s4 { left: 12%; top: 60%; font-size: 16px !important; }

/* header giống poster */
.hero { position: relative; z-index: 1; max-width: 1200px; margin: 0 auto; padding: 10px 20px 0; }
.hero-top { display: flex; align-items: center; gap: 14px; }
.logo { height: 34px; border-radius: 8px; flex: none; }
.who { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; margin-left: auto; }
.me-pick { display: flex; align-items: center; gap: 4px; background: rgba(255,255,255,.85); border-radius: 999px; padding: 4px 6px 4px 12px; box-shadow: 0 3px 10px rgba(214,45,120,.15); }
.me-pick select { border: 0; background: transparent; font-weight: 800; color: var(--pink-ink); max-width: 150px; outline: none; }
.chip { border: 0; border-radius: 999px; padding: 8px 14px; background: #fff; color: var(--pink-deep); font-weight: 800; cursor: pointer; box-shadow: 0 3px 10px rgba(214,45,120,.15); }
.chip.on { background: var(--pink-deep); color: #fff; }
.titles { display: flex; align-items: center; gap: 10px; }
.pill-title {
  font-family: 'Coiny', 'Baloo 2', sans-serif; font-size: 38px; line-height: 1.15; padding-top: 6px; white-space: nowrap; letter-spacing: .5px;
  background: linear-gradient(180deg, #ffb8d8 0%, #ff78b4 45%, #f24c96 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  filter: drop-shadow(2px 0 0 #9b2a5c) drop-shadow(-2px 0 0 #9b2a5c) drop-shadow(0 2px 0 #9b2a5c) drop-shadow(0 -2px 0 #9b2a5c) drop-shadow(0 3px 0 #7a1f47) drop-shadow(0 4px 6px rgba(120,20,60,.3));
}
.bubble {
  margin: 0; font-family: 'Coiny', 'Baloo 2', sans-serif; font-weight: 400; line-height: 1.15; white-space: nowrap;
  font-size: 38px; letter-spacing: 1px; padding-top: 6px;
  color: #ff7eb6;
  background: linear-gradient(180deg, #ffb8d8 0%, #ff78b4 45%, #f24c96 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  -webkit-text-stroke: 0; filter: drop-shadow(2px 0 0 #9b2a5c) drop-shadow(-2px 0 0 #9b2a5c) drop-shadow(0 2px 0 #9b2a5c) drop-shadow(0 -2px 0 #9b2a5c) drop-shadow(0 3px 0 #7a1f47) drop-shadow(0 4px 6px rgba(120,20,60,.3));
}
.mascot { height: 72px; width: auto; display: block; -webkit-mask-image: radial-gradient(ellipse 70% 75% at 55% 55%, #000 55%, transparent 85%); mask-image: radial-gradient(ellipse 70% 75% at 55% 55%, #000 55%, transparent 85%); }
.tabs { display: flex; gap: 6px; overflow-x: auto; padding: 10px 2px 0; scrollbar-width: none; }
.tabs a { flex: none; text-decoration: none; color: var(--pink-ink); background: rgba(255,255,255,.7); padding: 10px 16px; border-radius: 14px 14px 0 0; font-weight: 800; white-space: nowrap; }
.tabs a.active { background: #fff; color: var(--pink-deep); box-shadow: 0 -4px 12px rgba(214,45,120,.12); }
body:not(.is-admin) .admin-only { display: none !important; }

/* tấm bảng trắng chính */
.board { position: relative; z-index: 1; max-width: 1200px; margin: 0 auto; background: rgba(255,255,255,.96); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; min-height: 420px; }
.foot { position: relative; z-index: 1; text-align: center; color: var(--pink-ink); padding: 20px 16px 30px; font-size: 13px; }
.loading { padding: 60px; text-align: center; color: var(--muted); }

h2.sec { font-family: 'Baloo 2', sans-serif; font-weight: 800; color: var(--pink-deep); font-size: 24px; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
h2.sec .sub { font-family: 'Nunito'; font-size: 14px; color: var(--muted); font-weight: 700; }
h3.sub-sec { font-family: 'Baloo 2', sans-serif; color: var(--pink-ink); font-size: 19px; margin: 22px 0 10px; }
.muted { color: var(--muted); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.spacer { flex: 1; }
.grid2 { display: grid; grid-template-columns: 1.1fr 1fr; gap: 20px; }

/* nút */
.btn { border: 0; border-radius: 12px; padding: 10px 16px; font-weight: 800; cursor: pointer; background: var(--pink-soft); color: var(--pink-deep); transition: transform .08s, filter .15s; }
.btn:hover { filter: brightness(.97); } .btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(180deg, #ff7ab4, var(--pink-deep)); color: #fff; box-shadow: 0 5px 0 #b82469, 0 8px 16px rgba(214,45,120,.3); }
.btn.big { font-size: 18px; padding: 14px 26px; border-radius: 16px; }
.btn.ghost { background: #fff; border: 2px solid var(--line); }
.btn.danger { background: #ffe1e1; color: #b33b3b; }
.btn.sm { padding: 6px 10px; font-size: 13px; border-radius: 10px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* form */
.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); font-weight: 800; }
.field input, .field select, .field textarea, .inp { border: 2px solid var(--line); border-radius: 12px; padding: 9px 12px; background: #fff; color: var(--ink); font-weight: 700; outline: none; min-width: 0; }
.field input:focus, .field select:focus, .inp:focus { border-color: var(--pink); }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; background: var(--pink-soft); padding: 12px; border-radius: 16px; margin-bottom: 14px; }

/* dashboard */
.today-card { position: relative; background: linear-gradient(160deg, #fff 0%, #fff0f7 100%); border: 3px solid var(--line); border-radius: 24px; padding: 26px; text-align: center; overflow: hidden; }
.today-card .date { font-weight: 900; color: var(--pink-ink); font-size: 18px; }
.today-card .lbl { margin-top: 14px; color: var(--muted); font-weight: 800; }
.today-card .name { font-family: 'Baloo 2', sans-serif; font-weight: 800; color: var(--pink-deep); font-size: clamp(46px, 7vw, 72px); line-height: 1.05; margin: 6px 0; text-transform: uppercase; }
.today-card .dept { color: var(--muted); font-weight: 700; }
.today-card .note { margin: 14px auto; background: var(--pink-soft); border-radius: 14px; padding: 10px 14px; display: inline-block; color: var(--pink-ink); font-weight: 800; }
.today-card .done { color: var(--st-saved-i); font-weight: 900; font-size: 20px; margin-top: 14px; }
.today-card .todo { color: var(--muted); font-weight: 800; margin-top: 10px; }
.bell { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-radius: 14px; font-weight: 800; margin-bottom: 12px; }
.bell.me { background: #fff3bf; color: #7a5b00; } .bell.warn { background: #ffe0e0; color: #a33030; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stat { border-radius: 16px; padding: 14px; background: var(--pink-soft); }
.stat b { display: block; font-family: 'Baloo 2'; font-size: 30px; line-height: 1; color: var(--pink-deep); }
.stat span { font-size: 13px; color: var(--muted); font-weight: 800; }
.next { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 16px; border: 2px dashed var(--line); margin-bottom: 12px; }
.next .big { font-family: 'Baloo 2'; font-weight: 800; font-size: 24px; color: var(--pink-ink); }

/* danh sách tuần kiểu T2 An ✓ */
.week { display: grid; gap: 8px; }
.wk { display: grid; grid-template-columns: 64px 1fr auto; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 14px; font-weight: 800; }
.wk .d { font-weight: 900; } .wk .dd { font-size: 12px; opacity: .75; font-weight: 700; }
.wk.today { outline: 3px solid var(--pink); }
.c1 { background: var(--d1); color: var(--d1i); } .c2 { background: var(--d2); color: var(--d2i); } .c3 { background: var(--d3); color: var(--d3i); }
.c4 { background: var(--d4); color: var(--d4i); } .c5 { background: var(--d5); color: var(--d5i); } .c6 { background: var(--d6); color: var(--d6i); } .c0 { background: #eee; color: #777; }

/* bảng phân công giống poster: thành viên × thứ */
.poster { width: 100%; border-collapse: separate; border-spacing: 6px; table-layout: fixed; }
.poster th { padding: 10px 6px; border-radius: 12px; font-family: 'Baloo 2'; font-size: 17px; font-weight: 800; }
.poster th.mem { background: linear-gradient(180deg, #ff6aa9, var(--pink-deep)); color: #fff; text-align: left; padding-left: 16px; width: 26%; }
.poster th small { display: block; font-family: 'Nunito'; font-size: 12px; opacity: .8; font-weight: 700; margin-top: -3px; }
.poster td { height: 44px; border-radius: 12px; text-align: center; font-weight: 800; }
.poster td.mem { background: var(--pink-soft); text-align: left; padding: 0 10px 0 4px; color: var(--pink-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.num { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--pink-deep); color: #fff; font-weight: 900; margin-right: 8px; box-shadow: 0 3px 0 #b82469; }
.poster td.off { background: repeating-linear-gradient(45deg, #fafafa 0 6px, #f1f1f1 6px 12px) !important; }
.poster .tick { font-size: 20px; }
.poster-wrap { overflow-x: auto; }
.poster-wrap .poster { min-width: 720px; }
.weeknav { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.weeknav b { font-family: 'Baloo 2'; font-size: 18px; color: var(--pink-ink); }

/* bảng dữ liệu */
.tbl-wrap { overflow-x: auto; border: 2px solid var(--line); border-radius: 16px; }
.tbl { width: 100%; border-collapse: collapse; min-width: 640px; }
.tbl th { background: var(--pink-soft); color: var(--pink-ink); text-align: left; padding: 10px 12px; font-size: 13px; font-weight: 900; white-space: nowrap; }
.tbl td { padding: 9px 12px; border-top: 1px solid var(--line); vertical-align: middle; }
.tbl tr:hover td { background: #fff8fb; }
.tbl select { border: 2px solid var(--line); border-radius: 10px; padding: 5px 8px; font-weight: 800; background: #fff; }
.tbl tr.manual td { background: #fffbe8; }
.day-tag { display: inline-block; min-width: 54px; text-align: center; border-radius: 8px; padding: 3px 8px; font-weight: 900; font-size: 13px; }
.badge { display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; padding: 3px 10px; font-size: 12.5px; font-weight: 900; white-space: nowrap; }
.b-proposed { background: var(--st-proposed); color: var(--st-proposed-i); }
.b-saved { background: var(--st-saved); color: var(--st-saved-i); }
.b-done { background: var(--st-done); color: var(--st-done-i); }
.b-skipped { background: var(--st-skip); color: var(--st-skip-i); }
.b-active { background: var(--st-saved); color: var(--st-saved-i); }
.b-paused { background: var(--st-proposed); color: var(--st-proposed-i); }
.b-left { background: #eee; color: #777; }
.qo { display: inline-grid; place-items: center; min-width: 30px; height: 30px; border-radius: 50%; background: var(--pink-soft); color: var(--pink-deep); font-weight: 900; }
.errors { background: #ffe8e8; color: #9b2c2c; border-radius: 14px; padding: 12px 16px; margin: 12px 0; font-weight: 700; }
.errors b { display: block; margin-bottom: 4px; }
.warnbox { background: #fff6d6; color: #7a5b00; border-radius: 14px; padding: 12px 16px; margin: 12px 0; font-weight: 700; }
.empty { text-align: center; padding: 40px 10px; color: var(--muted); }
.empty .e { font-size: 44px; }
.chk { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 12px; border: 2px solid var(--line); font-weight: 800; cursor: pointer; background: #fff; }
.chk input { width: 18px; height: 18px; accent-color: var(--pink-deep); }
.card { border: 2px solid var(--line); border-radius: 18px; padding: 16px; margin-bottom: 14px; }

/* modal & toast */
.modal { position: fixed; inset: 0; background: rgba(90, 20, 55, .35); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal[hidden] { display: none; }
.modal-card { background: #fff; border-radius: 22px; padding: 22px; width: min(480px, 100%); max-height: 90vh; overflow: auto; box-shadow: var(--shadow); }
.modal-card h3 { margin: 0 0 14px; font-family: 'Baloo 2'; color: var(--pink-deep); font-size: 22px; }
.modal-card .form { display: grid; gap: 12px; }
.modal-card .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--pink-ink); color: #fff; padding: 12px 20px; border-radius: 14px; font-weight: 800; z-index: 60; box-shadow: var(--shadow); max-width: calc(100% - 32px); }
.toast[hidden] { display: none; }

@media (max-width: 860px) {
  .grid2 { grid-template-columns: 1fr; }
  .hero-top { flex-wrap: wrap; }
  .mascot { display: none; }
  .titles { order: 3; width: 100%; justify-content: center; flex-wrap: wrap; column-gap: 12px; row-gap: 0; }
  .board { padding: 14px; border-radius: 0 0 var(--radius) var(--radius); }
  .hero { padding: 12px 12px 0; }
}
@media (max-width: 480px) {
  .logo { height: 32px; }
  .me-pick select { max-width: 110px; }
  .bubble { font-size: 30px; }
  .pill-title { font-size: 30px; }
}

/* nhiều nhóm */
.chip { text-decoration: none; }
.chip.ghost { background: rgba(255,255,255,.6); color: var(--pink-ink); cursor: default; }
.tabs[hidden] { display: none; }
body:not(.in-group) .board { border-radius: var(--radius); margin-top: 12px; }
.auth { max-width: 420px; margin: 20px auto; }
.auth .form { display: grid; gap: 12px; }
.groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.gcard { display: block; text-decoration: none; border-radius: 20px; padding: 18px; transition: transform .1s, box-shadow .15s; box-shadow: 0 4px 0 rgba(0,0,0,.06); }
.gcard:hover { transform: translateY(-2px); box-shadow: 0 8px 18px rgba(214,45,120,.18); }
.gname { font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: 22px; line-height: 1.15; }
.gmeta { font-size: 13px; opacity: .8; margin: 2px 0 10px; }
.gtoday { background: rgba(255,255,255,.75); border-radius: 12px; padding: 8px 10px; color: var(--ink); font-size: 14px; }
.invite { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-top: 12px; background: var(--pink-soft); padding: 12px; border-radius: 14px; }
.invite .code { font-family: 'Baloo 2'; font-weight: 800; font-size: 28px; letter-spacing: 4px; color: var(--pink-deep); line-height: 1; }
@media (max-width: 480px) { #userChip { display: none; } }

/* lịch tháng */
.poster.month td.cal { height: 62px; vertical-align: top; text-align: left; padding: 6px 8px; }
.poster.month td.cal.out { opacity: .35; }
.poster.month td.is-today { outline: 3px solid var(--pink); outline-offset: -3px; }
.poster.month td.mine { box-shadow: inset 0 0 0 2px currentColor; }
.cal-d { font-size: 12px; font-weight: 900; opacity: .7; }
.cal-name { font-weight: 900; font-size: 15px; color: var(--ink); }
.cal-skip { font-size: 13px; color: var(--st-skip-i); font-weight: 800; }
.wk-lbl { font-size: 13px; }
.poster.month th.mem { width: 17%; }

/* dashboard gọn */
.dash { display: grid; grid-template-columns: 1fr 300px; gap: 16px; }
.hn { border: 2px solid var(--line); border-radius: 20px; background: linear-gradient(160deg, #fff, #fff0f7); padding: 16px 20px; display: flex; flex-direction: column; gap: 8px; }
.hn-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.hn-date { font-weight: 900; color: var(--pink-ink); }
.whoami { font-size: 13px; color: var(--muted); font-weight: 800; display: flex; align-items: center; gap: 6px; }
.whoami select { border: 2px solid var(--line); border-radius: 10px; padding: 4px 8px; font-weight: 800; background: #fff; color: var(--pink-ink); }
.hn-main { padding: 6px 0; }
.hn-lbl { color: var(--muted); font-weight: 800; }
.hn-big { font-family: 'Baloo 2', sans-serif; font-weight: 800; color: var(--pink-deep); font-size: clamp(34px, 5vw, 52px); line-height: 1.05; text-transform: uppercase; }
.hn-act { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 8px; }
.hn-ok { color: var(--st-saved-i); font-weight: 900; margin-top: 6px; }
.hn-late { color: #b33b3b; font-weight: 900; }
.hn-next { border-top: 2px dashed var(--line); padding-top: 10px; color: var(--pink-ink); }
.side { border: 2px solid var(--line); border-radius: 20px; padding: 16px; }
.side-t { font-family: 'Baloo 2', sans-serif; font-weight: 800; color: var(--pink-ink); font-size: 17px; margin-bottom: 8px; }
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.kpis div { background: var(--pink-soft); border-radius: 12px; padding: 8px 10px; }
.kpis b { font-family: 'Baloo 2'; font-size: 24px; color: var(--pink-deep); line-height: 1; display: block; }
.kpis span { font-size: 12px; color: var(--muted); font-weight: 800; }
.kpis .bad { background: #ffe0e0; } .kpis .bad b { color: #b33b3b; }
.wstrip { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.ws { border-radius: 14px; padding: 10px 12px; min-height: 64px; }
.ws.past { opacity: .55; }
.ws.is-today { outline: 3px solid var(--pink); }
.ws.mine { box-shadow: inset 0 0 0 2px currentColor; }
.ws-d { font-size: 12px; font-weight: 900; opacity: .8; }
.ws-n { margin-top: 4px; color: var(--ink); }
@media (max-width: 860px) { .dash { grid-template-columns: 1fr; } .wstrip { grid-template-columns: repeat(3, 1fr); } }
td[data-cell] { cursor: pointer; } td[data-cell]:hover { filter: brightness(.95); }
.opt { display: flex; gap: 10px; align-items: flex-start; border: 2px solid var(--line); border-radius: 14px; padding: 10px 12px; cursor: pointer; }
.opt:has(input:checked) { border-color: var(--pink); background: #fff5fa; }
.opt input { margin-top: 4px; accent-color: var(--pink-deep); }
.opt .muted { font-size: 13px; }

/* header cố định khi cuộn */
.hero { position: sticky; top: 0; z-index: 20; background: var(--pink-bg1); box-shadow: 0 0 0 100vmax var(--pink-bg1); clip-path: inset(0 -100vmax); }

/* Chủ nhật */
:root { --d7: #ffd9d9; --d7i: #b33b5b; }
.c7 { background: var(--d7); color: var(--d7i); }

/* ô chọn giờ gọn */
.tp { position: relative; }
.tp-btn { border: 2px solid var(--line); border-radius: 12px; padding: 8px 14px; background: #fff; cursor: pointer; font-size: 16px; color: var(--pink-ink); }
.tp-btn b { font-size: 20px; color: var(--pink-deep); letter-spacing: 1px; }
.tp-pop { position: absolute; top: calc(100% + 6px); left: 0; z-index: 30; background: #fff; border-radius: 16px; box-shadow: var(--shadow); border: 2px solid var(--line); padding: 12px; width: 280px; }
.tp-pop[hidden] { display: none; }
.tp-lbl { font-size: 12px; font-weight: 900; color: var(--muted); margin: 2px 0 6px; }
.tp-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; margin-bottom: 8px; }
.tp-grid button { border: 0; border-radius: 8px; padding: 6px 0; background: var(--pink-soft); color: var(--pink-ink); font-weight: 800; cursor: pointer; }
.tp-grid button:hover { filter: brightness(.95); }
.tp-grid button.on { background: var(--pink-deep); color: #fff; }
