:root {
  --bg: #ffffff;
  --bg-soft: #f7f7f5;
  --bg-hover: #efefed;
  --sidebar: #f7f7f5;
  --text: #1f2328;
  --text-2: #5f6670;
  --text-3: #8b929b;
  --border: #e6e6e3;
  --primary: #2f6fed;
  --primary-soft: #e8f0fe;
  --danger: #d1242f;
  --danger-soft: #fdecec;
  --warn: #bf8700;
  --warn-soft: #fff6dc;
  --ok: #1f883d;
  --ok-soft: #e6f6ea;
  --shadow: 0 8px 30px rgba(15, 23, 42, .12);
  --radius: 10px;
  --sidebar-w: 248px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #191919;
    --bg-soft: #202020;
    --bg-hover: #2c2c2c;
    --sidebar: #202020;
    --text: #e8e8e6;
    --text-2: #a8adb3;
    --text-3: #7d838a;
    --border: #333;
    --primary: #5b8ff9;
    --primary-soft: #1d2a44;
    --danger: #ff6b6b;
    --danger-soft: #3a1e1e;
    --warn: #e3b341;
    --warn-soft: #3a3020;
    --ok: #4ac26b;
    --ok-soft: #1c3424;
    --shadow: 0 8px 30px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 15px/1.5 "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); }
h1, h2, h3 { line-height: 1.25; margin: 0; }
.hidden { display: none !important; }
.muted { color: var(--text-2); }
.small { font-size: 13px; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.spacer { flex: 1; }

/* ---------- Nút & form ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--border); background: var(--bg); padding: 7px 14px;
  border-radius: 8px; cursor: pointer; font-weight: 500; white-space: nowrap; min-height: 36px;
}
.btn:hover { background: var(--bg-hover); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: var(--danger); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--bg-hover); }
.btn.sm { padding: 4px 10px; min-height: 30px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.icon-btn {
  border: 0; background: transparent; width: 36px; height: 36px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text-2); position: relative;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }
.icon-btn svg, .btn svg, .nav-item svg { width: 18px; height: 18px; flex: none; }

input[type=text], input[type=email], input[type=password], input[type=search], input[type=datetime-local], input[type=date], input[type=number], select, textarea {
  width: 100%; border: 1px solid var(--border); background: var(--bg); border-radius: 8px; padding: 8px 10px; min-height: 38px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
textarea { resize: vertical; min-height: 80px; }
label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 4px; font-weight: 500; }
.check-line { display: flex; align-items: center; gap: 8px; margin: 8px 0; cursor: pointer; }
.check-line input { width: 18px; height: 18px; }

/* ---------- Khởi động & đăng nhập ---------- */
.boot { display: grid; place-items: center; height: 100vh; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--bg-soft); }
.auth-card { width: 100%; max-width: 400px; background: var(--bg); border: 1px solid var(--border); border-radius: 16px; padding: 28px 24px; box-shadow: var(--shadow); }
.auth-card .logo { width: 52px; height: 52px; margin-bottom: 12px; }
.auth-card h1 { font-size: 22px; margin-bottom: 4px; }
.auth-card p.lead { color: var(--text-2); margin: 0 0 20px; }
.auth-card .btn.primary { width: 100%; margin-top: 4px; min-height: 42px; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--text-3); font-size: 13px; margin: 18px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.google-slot { display: flex; justify-content: center; min-height: 44px; }
.auth-links { margin-top: 16px; text-align: center; font-size: 14px; }
.auth-links a { cursor: pointer; }
.form-error { color: var(--danger); font-size: 14px; min-height: 20px; margin: 4px 0 8px; }

/* ---------- Bố cục chính ---------- */
.layout { display: flex; height: 100vh; height: 100dvh; overflow: hidden; }
.sidebar {
  width: var(--sidebar-w); flex: none; background: var(--sidebar); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; overflow-y: auto; padding: 10px 8px;
}
.ws-head { display: flex; align-items: center; gap: 10px; padding: 6px 8px 12px; }
.ws-head img { width: 28px; height: 28px; }
.ws-head .ws-name { font-weight: 650; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-section { margin-top: 14px; }
.nav-title { font-size: 12px; font-weight: 600; color: var(--text-3); padding: 4px 10px; display: flex; align-items: center; justify-content: space-between; text-transform: uppercase; letter-spacing: .03em; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 7px; color: var(--text-2);
  text-decoration: none; cursor: pointer; font-size: 14.5px; user-select: none;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text); }
.nav-item.active { background: var(--bg-hover); color: var(--text); font-weight: 600; }
.nav-item .count { margin-left: auto; font-size: 12px; color: var(--text-3); }
.nav-item .count.red { color: #fff; background: var(--danger); border-radius: 10px; padding: 0 7px; }
.dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.me-chip { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; cursor: pointer; margin-top: auto; }
.me-chip:hover { background: var(--bg-hover); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 8px; padding: 10px 20px; border-bottom: 1px solid var(--border); min-height: 56px; }
.topbar h1 { font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .search { max-width: 280px; margin-left: auto; }
.topbar .search input { min-height: 34px; padding: 6px 10px; background: var(--bg-soft); }
.menu-btn { display: none; }
.content { flex: 1; overflow-y: auto; padding: 18px 24px 100px; }
.content-inner { max-width: 920px; margin: 0 auto; }
.badge { position: absolute; top: 2px; right: 2px; background: var(--danger); color: #fff; font-size: 10.5px; font-weight: 700; border-radius: 9px; min-width: 17px; height: 17px; padding: 0 4px; display: grid; place-items: center; }

.bottomnav { display: none; }
.fab {
  position: fixed; right: 22px; bottom: calc(22px + var(--safe-b)); width: 56px; height: 56px; border-radius: 50%; border: 0;
  background: var(--primary); color: #fff; box-shadow: 0 6px 20px rgba(47, 111, 237, .45); cursor: pointer; z-index: 30;
  display: grid; place-items: center;
}
.fab svg { width: 26px; height: 26px; }

/* ---------- Nhập nhanh ---------- */
.quickadd { border: 1px solid var(--border); border-radius: 12px; padding: 4px 6px 4px 12px; display: flex; align-items: center; gap: 8px; background: var(--bg); margin-bottom: 8px; }
.quickadd:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.quickadd input { border: 0 !important; box-shadow: none !important; padding: 8px 0; background: transparent; }
.quick-preview { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; min-height: 0; }
.quick-hint { font-size: 12.5px; color: var(--text-3); margin: -2px 0 14px; }
.quick-hint code { background: var(--bg-soft); padding: 1px 5px; border-radius: 4px; }

/* ---------- Bộ lọc ---------- */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.filters select { width: auto; min-height: 32px; padding: 4px 8px; font-size: 13.5px; background: var(--bg-soft); }

/* ---------- Danh sách việc ---------- */
.group-title { font-size: 13px; font-weight: 650; color: var(--text-2); margin: 18px 0 4px; display: flex; gap: 8px; align-items: center; }
.group-title.red { color: var(--danger); }
.group-title .n { font-weight: 500; color: var(--text-3); }
.task-row {
  display: flex; align-items: flex-start; gap: 10px; padding: 9px 8px; border-bottom: 1px solid var(--border); cursor: pointer; border-radius: 6px;
}
.task-row:hover { background: var(--bg-soft); }
.task-row.done .t-title { text-decoration: line-through; color: var(--text-3); }
.check {
  width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--text-3); background: transparent; flex: none; cursor: pointer;
  margin-top: 1px; display: grid; place-items: center; padding: 0;
}
.check.p-urgent { border-color: var(--danger); background: var(--danger-soft); }
.check.p-high { border-color: var(--warn); background: var(--warn-soft); }
.check:hover { background: var(--ok-soft); border-color: var(--ok); }
.check.checked { background: var(--ok); border-color: var(--ok); }
.check.checked::after { content: ""; width: 5px; height: 9px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg) translate(-1px, -1px); }
.t-body { flex: 1; min-width: 0; }
.t-title { word-break: break-word; }
.t-meta { display: flex; flex-wrap: wrap; gap: 6px 10px; margin-top: 3px; font-size: 12.5px; color: var(--text-2); align-items: center; }
.t-meta .m { display: inline-flex; align-items: center; gap: 4px; }
.t-meta svg { width: 13px; height: 13px; }
.due.overdue { color: var(--danger); font-weight: 600; }
.due.today { color: var(--warn); font-weight: 600; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; background: var(--bg-soft); border: 1px solid var(--border); font-size: 12.5px; color: var(--text-2); }
.chip.blue { background: var(--primary-soft); color: var(--primary); border-color: transparent; }
.chip.red { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.chip.yellow { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.chip.green { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.status-pill { font-size: 11.5px; padding: 1px 7px; border-radius: 999px; font-weight: 600; }
.st-todo { background: var(--bg-hover); color: var(--text-2); }
.st-doing { background: var(--primary-soft); color: var(--primary); }
.st-review { background: var(--warn-soft); color: var(--warn); }
.st-done { background: var(--ok-soft); color: var(--ok); }
.avatars { display: flex; flex: none; }
.avatar {
  width: 24px; height: 24px; border-radius: 50%; color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center;
  border: 2px solid var(--bg); margin-left: -6px; flex: none; text-transform: uppercase;
}
.avatars .avatar:first-child { margin-left: 0; }
.avatar.lg { width: 34px; height: 34px; font-size: 13px; margin: 0; }
.empty { text-align: center; color: var(--text-3); padding: 50px 10px; }
.empty .big { font-size: 40px; margin-bottom: 8px; }

/* ---------- Thống kê ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 18px; }
.stat { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; cursor: pointer; }
.stat:hover { background: var(--bg-soft); }
.stat .v { font-size: 26px; font-weight: 700; }
.stat .l { font-size: 13px; color: var(--text-2); }
.stat.red .v { color: var(--danger); }
.stat.yellow .v { color: var(--warn); }
.stat.green .v { color: var(--ok); }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { padding: 9px 12px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
.tbl th { font-size: 12.5px; color: var(--text-2); font-weight: 600; background: var(--bg-soft); }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td.num { text-align: center; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: var(--bg-soft); }
.bar { height: 6px; background: var(--bg-hover); border-radius: 3px; overflow: hidden; min-width: 80px; }
.bar > i { display: block; height: 100%; background: var(--ok); }

/* ---------- Thẻ / mục cài đặt ---------- */
.card { border: 1px solid var(--border); border-radius: 12px; padding: 18px; margin-bottom: 16px; }
.card h2 { font-size: 16px; margin-bottom: 4px; }
.card > p.muted { margin-top: 0; font-size: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.help { font-size: 13px; color: var(--text-2); background: var(--bg-soft); border-radius: 8px; padding: 10px 12px; margin: 6px 0 12px; }
.help ol { margin: 4px 0; padding-left: 20px; }
.copy-box { display: flex; gap: 6px; }
.copy-box input { font-size: 13px; }

/* ---------- Bảng Kanban ---------- */
.board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; scroll-snap-type: x mandatory; }
.col { flex: 0 0 280px; background: var(--bg-soft); border-radius: 12px; padding: 10px; scroll-snap-align: start; min-height: 120px; }
.col.drag-over { outline: 2px dashed var(--primary); }
.col-head { display: flex; align-items: center; gap: 8px; font-weight: 650; font-size: 14px; padding: 2px 4px 10px; }
.col-head .n { color: var(--text-3); font-weight: 500; }
.kcard { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 10px; margin-bottom: 8px; cursor: grab; box-shadow: 0 1px 2px rgba(0, 0, 0, .04); }
.kcard:hover { border-color: var(--text-3); }
.kcard.dragging { opacity: .5; }
.kcard .t-title { font-weight: 500; font-size: 14px; }
.kcard .foot { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; gap: 6px; }

/* ---------- Lịch ---------- */
.cal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.cal-head h2 { font-size: 17px; min-width: 150px; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.cal .wd { background: var(--bg-soft); font-size: 12px; font-weight: 600; color: var(--text-2); padding: 6px; text-align: center; border-bottom: 1px solid var(--border); }
.cal .day { min-height: 96px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 4px; cursor: pointer; overflow: hidden; }
.cal .day:nth-child(7n) { border-right: 0; }
.cal .day.other { background: var(--bg-soft); color: var(--text-3); }
.cal .day.sel { box-shadow: inset 0 0 0 2px var(--primary); }
.cal .num { font-size: 12.5px; font-weight: 600; display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; }
.cal .day.today .num { background: var(--primary); color: #fff; }
.cal .ev { font-size: 11.5px; padding: 1px 5px; border-radius: 4px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: var(--primary-soft); color: var(--primary); }
.cal .ev.late { background: var(--danger-soft); color: var(--danger); }
.cal .ev.done { background: var(--ok-soft); color: var(--ok); text-decoration: line-through; }
.cal .more { font-size: 11px; color: var(--text-3); padding-left: 4px; }
.cal .dots { display: none; }

/* ---------- Ngăn chi tiết công việc ---------- */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .25); z-index: 40; opacity: 0; pointer-events: none; transition: opacity .2s; }
.drawer-backdrop.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100%); background: var(--bg); z-index: 41; box-shadow: var(--shadow);
  transform: translateX(105%); transition: transform .22s ease; display: flex; flex-direction: column;
}
.drawer.open { transform: none; }
.drawer-head { display: flex; align-items: center; gap: 6px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.drawer-body { flex: 1; overflow-y: auto; padding: 16px 20px 40px; }
.drawer-foot { padding: 10px 16px calc(10px + var(--safe-b)); border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }
.title-input { font-size: 20px; font-weight: 650; border: 0 !important; box-shadow: none !important; padding: 4px 0 !important; resize: none; min-height: 0 !important; overflow: hidden; background: transparent; }
.props { display: grid; grid-template-columns: 120px 1fr; gap: 8px 12px; align-items: center; margin: 12px 0 16px; font-size: 14px; }
.props > .k { color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.props select, .props input { min-height: 34px; padding: 5px 8px; }
.assignee-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.pick { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 3px; border-radius: 999px; border: 1px solid var(--border); cursor: pointer; font-size: 13px; background: var(--bg); }
.pick .avatar { width: 22px; height: 22px; font-size: 10px; border: 0; }
.pick.on { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.pick.disabled { cursor: default; }
.section-h { font-size: 13px; font-weight: 650; color: var(--text-2); margin: 20px 0 8px; display: flex; align-items: center; gap: 8px; }
.checklist .ci { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.checklist .ci input[type=checkbox] { width: 17px; height: 17px; flex: none; }
.checklist .ci .txt { flex: 1; }
.checklist .ci.done .txt { text-decoration: line-through; color: var(--text-3); }
.checklist .ci .icon-btn { width: 28px; height: 28px; opacity: .6; }
.progress { font-weight: 500; color: var(--text-3); }
.comment { display: flex; gap: 10px; margin-bottom: 12px; }
.comment .bubble { background: var(--bg-soft); border-radius: 10px; padding: 8px 12px; flex: 1; min-width: 0; }
.comment .who { font-size: 13px; font-weight: 600; }
.comment .who .muted { font-weight: 400; margin-left: 6px; }
.comment .txt { white-space: pre-wrap; word-break: break-word; font-size: 14px; }
.comment-box { display: flex; gap: 8px; align-items: flex-end; }
.comment-box textarea { min-height: 40px; height: 40px; }
.activity { font-size: 13px; color: var(--text-2); }
.activity div { padding: 3px 0; }
.tags-input { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; border: 1px solid var(--border); border-radius: 8px; padding: 4px 6px; min-height: 34px; }
.tags-input input { border: 0 !important; box-shadow: none !important; min-height: 26px !important; padding: 2px !important; flex: 1; min-width: 80px; width: auto; }
.chip .x { cursor: pointer; opacity: .6; margin-left: 2px; }

/* ---------- Chọn nhiều, duyệt, file đính kèm, @nhắc tên ---------- */
.task-row.picked { background: var(--primary-soft); }
.sel-box { width: 18px; height: 18px; margin-top: 2px; flex: none; accent-color: var(--primary); }
.bulkbar {
  position: sticky; bottom: 12px; z-index: 15; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px;
  background: var(--bg); border: 1px solid var(--border); box-shadow: var(--shadow); border-radius: 12px; padding: 8px 10px;
}
.bulkbar select { width: auto; min-height: 30px; padding: 2px 8px; font-size: 13px; }
.bulkbar .n { font-size: 14px; margin-right: 4px; }
.review-banner { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: var(--warn-soft); border-radius: 10px; padding: 10px 12px; margin: 8px 0 4px; font-size: 14px; }
.attach-list { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.attach { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px; border: 1px solid var(--border); border-radius: 8px; }
.attach img { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; display: block; }
.attach .file-ic { width: 48px; height: 48px; display: grid; place-items: center; background: var(--bg-soft); border-radius: 6px; color: var(--text-2); }
.attach .fname { font-size: 14px; font-weight: 500; text-decoration: none; color: var(--text); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach .fname:hover { text-decoration: underline; }
.mention-suggest { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
@media (max-width: 860px) {
  .bulkbar { bottom: calc(66px + var(--safe-b)); }
}

.phone-remind { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: -4px 0 14px; }
.kcard .move-btn { min-height: 28px; padding: 2px 10px; font-size: 12.5px; }

/* ---------- Thông báo ---------- */
.notif { display: flex; gap: 12px; padding: 12px 10px; border-bottom: 1px solid var(--border); cursor: pointer; border-radius: 6px; }
.notif:hover { background: var(--bg-soft); }
.notif.unread { background: var(--primary-soft); }
.notif .ic { font-size: 20px; width: 26px; text-align: center; flex: none; }
.notif .tt { font-weight: 550; }
.notif .bd { font-size: 13.5px; color: var(--text-2); }

/* ---------- Toast & menu ---------- */
#toasts { position: fixed; left: 50%; bottom: calc(24px + var(--safe-b)); transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: #24292f; color: #fff; padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow); font-size: 14px; display: flex; gap: 14px; align-items: center; pointer-events: auto; animation: pop .18s ease; max-width: 92vw; }
.toast.err { background: var(--danger); }
.toast button { background: transparent; border: 0; color: #8ab4ff; font-weight: 700; cursor: pointer; padding: 0; }
@keyframes pop { from { transform: translateY(10px); opacity: 0; } }
.modal-back { position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 60; display: grid; place-items: center; padding: 16px; }
.modal { background: var(--bg); border-radius: 14px; padding: 20px; width: 100%; max-width: 440px; box-shadow: var(--shadow); max-height: 90vh; overflow-y: auto; }
.modal h2 { font-size: 18px; margin-bottom: 14px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.install-banner { display: flex; align-items: center; gap: 10px; background: var(--primary-soft); color: var(--text); padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; font-size: 14px; }

/* ---------- Điện thoại ---------- */
@media (max-width: 860px) {
  .sidebar {
    position: fixed; z-index: 50; top: 0; bottom: 0; left: 0; transform: translateX(-102%); transition: transform .22s ease; box-shadow: var(--shadow);
    padding-top: calc(10px + env(safe-area-inset-top, 0px));
  }
  .sidebar.open { transform: none; }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 8px 10px; padding-top: calc(8px + env(safe-area-inset-top, 0px)); position: sticky; top: 0; background: var(--bg); z-index: 5; }
  .topbar .search { display: none; }
  .topbar .search.show { display: block; position: absolute; left: 8px; right: 8px; top: 8px; max-width: none; z-index: 6; }
  .content { padding: 12px 14px calc(140px + var(--safe-b)); }
  .bottomnav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; background: var(--bg); border-top: 1px solid var(--border); z-index: 20;
    padding-bottom: var(--safe-b);
  }
  .bottomnav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 0 6px; font-size: 11px; color: var(--text-3); text-decoration: none; position: relative; }
  .bottomnav a svg { width: 22px; height: 22px; }
  .bottomnav a.active { color: var(--primary); font-weight: 600; }
  .bottomnav .badge { top: 2px; right: calc(50% - 20px); }
  .fab { bottom: calc(72px + var(--safe-b)); right: 16px; }
  .drawer { width: 100%; }
  .drawer-body { padding: 12px 16px 40px; }
  .props { grid-template-columns: 96px 1fr; }
  .grid2 { grid-template-columns: 1fr; }
  .cal .day { min-height: 54px; padding: 2px; }
  .cal .ev, .cal .more { display: none; }
  .cal .dots { display: flex; gap: 2px; justify-content: center; margin-top: 2px; flex-wrap: wrap; }
  .cal .dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--primary); }
  .cal .dots i.late { background: var(--danger); }
  .cal .dots i.done { background: var(--ok); }
  .col { flex-basis: 84vw; }
  .task-row { padding: 11px 4px; }
  .hide-mobile { display: none !important; }
}
@media (min-width: 861px) {
  .hide-desktop { display: none !important; }
}
