/* ===================================================================
   Giao diện "Trong trẻo" (sáng) + "Tối sang" kính mờ (tối)
   Đổi tông bằng thuộc tính data-theme trên thẻ gốc (nút Sáng/Tối).
   =================================================================== */

:root {
  /* --- Tông SÁNG (mặc định) --- */
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f1f3f9;
  --border: #e8ebf2;
  --fg: #1a1f2e;
  --fg-soft: #6b7280;
  --fg-faint: #9aa3b2;
  --accent: #6366f1;
  --accent-2: #8b5cf6;
  --accent-soft: #eef2ff;
  --accent-hover: #4f46e5;
  --done: #10b981;
  --done-soft: #e7f8f1;
  --warn: #f59e0b;
  --warn-soft: #fef3e2;
  --urgent: #ef4444;
  --urgent-soft: #fde8e8;
  --shadow: 0 1px 2px rgba(16,24,40,.05), 0 6px 20px rgba(16,24,40,.06);
  --shadow-lg: 0 16px 48px rgba(16,24,40,.18);
  --radius: 18px;
  --card-radius: 15px;
  --glass: none;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --title-font: "Plus Jakarta Sans", "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
}

:root[data-theme="dark"] {
  /* --- Tông TỐI SANG (kính mờ) --- */
  --bg: radial-gradient(1200px 520px at 12% -10%, #1e2a5a 0%, transparent 60%),
        radial-gradient(1000px 520px at 100% 0%, #3b1d5e 0%, transparent 55%), #0b1020;
  --surface: rgba(255,255,255,.07);
  --surface-2: rgba(255,255,255,.05);
  --border: rgba(255,255,255,.10);
  --fg: #eef1f8;
  --fg-soft: #9aa4c0;
  --fg-faint: #6b76a0;
  --accent: #6ea8fe;
  --accent-2: #c084fc;
  --accent-soft: rgba(110,168,254,.16);
  --accent-hover: #86b7ff;
  --done: #34d399;
  --done-soft: rgba(52,211,153,.16);
  --warn: #fbbf24;
  --warn-soft: rgba(251,191,36,.15);
  --urgent: #fb7185;
  --urgent-soft: rgba(251,113,133,.16);
  --shadow: 0 8px 30px rgba(0,0,0,.4);
  --shadow-lg: 0 24px 60px rgba(0,0,0,.55);
  --glass: blur(14px);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); background-attachment: fixed; color: var(--fg);
  font-family: var(--font); font-size: 14px; line-height: 1.5; min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; }
[hidden] { display: none !important; }
/* Nới khoảng dòng cho ô nhập để không cắt mất dấu tiếng Việt trên chữ hoa (Ỗ, Ộ, Ẫ...) */
input[type="text"], input[type="password"], input[type="date"], input[type="search"],
input[type="email"], input[type="tel"], input[type="number"], textarea, select {
  line-height: 1.5;
}

/* ===== Trang đăng nhập ===== */
.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-box {
  width: 100%; max-width: 390px; background: var(--surface); backdrop-filter: var(--glass);
  border: 1px solid var(--border); border-radius: 22px; box-shadow: var(--shadow-lg); padding: 34px 30px;
}
.login-box .logo {
  width: 56px; height: 56px; border-radius: 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; display: grid; place-items: center; font-size: 28px; font-weight: 800;
  margin: 0 auto 18px; box-shadow: 0 8px 22px color-mix(in srgb, var(--accent) 40%, transparent);
}
.login-box h1 { font-family: var(--title-font); font-size: 22px; font-weight: 800; text-align: center; margin: 0 0 4px; letter-spacing: -.3px; }
.login-box p.sub { text-align: center; color: var(--fg-faint); font-size: 13px; margin: 0 0 24px; }
.field { margin-bottom: 15px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 7px; color: var(--fg-soft); }
.field input {
  width: 100%; padding: 12px 14px; font-size: 15px; border: 1px solid var(--border);
  border-radius: 12px; background: var(--surface-2); color: var(--fg);
}
.field input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.btn-primary {
  width: 100%; padding: 13px; font-size: 15px; font-weight: 700; color: #fff; margin-top: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); border: 0; border-radius: 12px; cursor: pointer;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 32%, transparent);
}
.btn-primary:hover { filter: brightness(1.05); }
.btn-primary:disabled { opacity: .6; cursor: default; filter: none; }
.login-error {
  background: var(--urgent-soft); color: var(--urgent); font-size: 13px; font-weight: 600;
  padding: 11px 13px; border-radius: 12px; margin-bottom: 14px; text-align: center;
}

/* ===== Bố cục: menu trái + khu nội dung ===== */
.layout { display: flex; min-height: 100vh; }

/* Menu bên trái */
.sidebar {
  width: 248px; flex: none; display: flex; flex-direction: column; gap: 6px;
  padding: 18px 14px; background: var(--surface); backdrop-filter: var(--glass);
  border-right: 1px solid var(--border);
  position: sticky; top: 0; align-self: flex-start; height: 100vh; overflow-y: auto; z-index: 30;
}
.side-brand { display: flex; align-items: center; gap: 11px; padding: 4px 6px 2px; margin-bottom: 18px; }
.side-brand .logo {
  width: 38px; height: 38px; border-radius: 11px; flex: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 19px;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 38%, transparent);
}
.side-name { font-family: var(--title-font); font-weight: 800; font-size: 17px; letter-spacing: -.3px; }
.side-nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; width: 100%; text-align: left;
  border: 0; background: transparent; color: var(--fg-soft); font: inherit; font-size: 14px; font-weight: 600;
  padding: 11px 13px; border-radius: 11px; cursor: pointer;
}
.nav-item .ni-ic { font-size: 17px; line-height: 1; }
.nav-item:hover { background: var(--surface-2); color: var(--fg); }
.nav-item[aria-current="true"] { background: var(--accent-soft); color: var(--accent); }

.side-backdrop { position: fixed; inset: 0; background: rgba(13,16,28,.5); z-index: 29; }

/* Khu nội dung bên phải */
.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 13px 26px; border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(12px);
}
.tb-spacer { flex: 1; }
.icon-btn {
  width: 40px; height: 40px; flex: none; border: 1px solid var(--border); background: var(--surface-2);
  color: var(--fg); border-radius: 11px; font-size: 18px; cursor: pointer;
}
.icon-btn:hover { background: var(--surface); }
.hamburger { display: none; }          /* chỉ hiện trên điện thoại */
.work-toggle[hidden] { display: none; }

.view-switch { display: flex; gap: 4px; background: var(--surface-2); padding: 5px; border-radius: 12px; }
.view-switch button {
  border: 0; background: transparent; color: var(--fg-soft); font-size: 13px; font-weight: 600;
  padding: 8px 14px; border-radius: 9px; cursor: pointer; display: flex; align-items: center; gap: 5px;
}
.view-switch button[aria-selected="true"] { background: var(--surface); color: var(--accent); box-shadow: var(--shadow); }

.btn-add {
  color: #fff; border: 0; border-radius: 12px; padding: 10px 17px; font-size: 14px; font-weight: 700; cursor: pointer;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 34%, transparent);
  display: flex; align-items: center; gap: 6px;
}
.btn-add:hover { filter: brightness(1.05); }
.btn-ghost {
  background: var(--surface-2); color: var(--fg-soft); border: 1px solid var(--border);
  border-radius: 12px; padding: 9px 13px; font-size: 14px; font-weight: 600; cursor: pointer;
}
.btn-ghost:hover { color: var(--fg); }

main.content { width: 100%; padding: 22px 26px 60px; }

/* Lời chào đầu trang */
.greet { font-family: var(--title-font); font-weight: 700; font-size: 21px; margin: 2px 2px 20px; letter-spacing: -.2px; }
.greet b { background: linear-gradient(90deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }

.loading, .empty-all { text-align: center; color: var(--fg-faint); padding: 50px 20px; font-size: 14px; }

/* ===== Kanban ===== */
.kanban { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; align-items: start; }
.col { background: var(--surface-2); backdrop-filter: var(--glass); border-radius: var(--radius); padding: 14px; min-width: 0; min-height: 120px; }
.col.drag-over { outline: 2px dashed var(--accent); outline-offset: -2px; }
.col > h2 { font-family: var(--title-font); font-size: 14px; margin: 2px 4px 13px; display: flex; align-items: center; gap: 9px; font-weight: 700; }
.col > h2 .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.col > h2 .col-name { margin-right: auto; }
.col > h2 .count { background: var(--surface); color: var(--fg-soft); font-size: 11.5px; padding: 2px 9px; border-radius: 999px; font-weight: 700; }
.col-add { border: 0; background: transparent; color: var(--fg-faint); cursor: pointer; font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 8px; flex: none; white-space: nowrap; }
.col-add:hover { background: var(--surface); color: var(--accent); }

/* ===== Danh sách thông minh ===== */
.list-view { max-width: 860px; margin: 0; }
.section-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--fg-faint); margin: 24px 4px 10px; display: flex; align-items: center; gap: 8px; }
.section-title .count { background: var(--surface-2); color: var(--fg-soft); font-size: 11px; padding: 1px 8px; border-radius: 999px; font-weight: 700; letter-spacing: 0; }

/* ===== Thẻ công việc ===== */
.card {
  position: relative; background: var(--surface); backdrop-filter: var(--glass);
  border: 1px solid var(--border); border-radius: var(--card-radius); box-shadow: var(--shadow);
  margin-bottom: 11px; overflow: hidden; transition: transform .12s, box-shadow .12s;
}
.card:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.card.dragging { opacity: .5; }
.card.is-done { opacity: .9; }
.card.is-done:hover { transform: none; box-shadow: var(--shadow); }
.card .row { display: flex; align-items: flex-start; gap: 12px; padding: 13px 15px; }
.card .drag-handle { cursor: grab; color: var(--fg-faint); font-size: 15px; line-height: 1; padding-top: 3px; user-select: none; flex: none; touch-action: none; }

.check { width: 22px; height: 22px; border-radius: 8px; border: 2px solid var(--fg-faint); background: transparent; cursor: pointer; flex: none; margin-top: 1px; display: grid; place-items: center; transition: all .15s; padding: 0; }
.check svg { width: 12px; height: 12px; opacity: 0; transition: opacity .15s; }
.check:hover { border-color: var(--accent); }
.card.is-done .check { background: var(--done); border-color: var(--done); }
.card.is-done .check svg { opacity: 1; }

.card .body { flex: 1; min-width: 0; }
.card .title-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card .title { font-size: 14.5px; font-weight: 600; word-break: break-word; }
.card.is-done .title { color: var(--fg-faint); text-decoration: line-through; }
.card .note { font-size: 12.5px; color: var(--fg-soft); margin-top: 4px; white-space: pre-wrap; word-break: break-word; }

.chip { font-size: 11.5px; font-weight: 600; padding: 2px 9px; border-radius: 999px; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.chip.date { background: var(--surface-2); color: var(--fg-soft); }
.chip.soon { background: var(--warn-soft); color: var(--warn); }
.chip.urgent { background: var(--urgent-soft); color: var(--urgent); }
.chip.type { background: var(--accent-soft); color: var(--accent); }

.progress-wrap { display: flex; align-items: center; gap: 9px; margin-top: 10px; }
.progress { flex: 1; height: 7px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .3s; }
.progress-wrap .pct { font-size: 11.5px; color: var(--fg-soft); font-weight: 700; font-variant-numeric: tabular-nums; }

.card .menu-btn { border: 0; background: transparent; color: var(--fg-faint); cursor: pointer; font-size: 18px; line-height: 1; padding: 2px 4px; border-radius: 6px; flex: none; }
.card .menu-btn:hover { background: var(--surface-2); color: var(--fg); }

.toggle-sub { border: 0; background: transparent; color: var(--accent); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; padding: 4px 15px 11px; display: inline-flex; align-items: center; gap: 5px; }
.toggle-sub .arrow { transition: transform .2s; display: inline-block; }
.toggle-sub[aria-expanded="true"] .arrow { transform: rotate(90deg); }
.subs { border-top: 1px solid var(--border); background: var(--surface-2); }
.sub-row { display: flex; align-items: center; gap: 10px; padding: 10px 15px 10px 16px; border-bottom: 1px solid var(--border); }
.sub-row:last-child { border-bottom: 0; }
.sub-check { width: 18px; height: 18px; border-radius: 6px; border: 2px solid var(--fg-faint); cursor: pointer; flex: none; display: grid; place-items: center; background: transparent; padding: 0; }
.sub-check svg { width: 10px; height: 10px; opacity: 0; }
.sub-row.done .sub-check { background: var(--done); border-color: var(--done); }
.sub-row.done .sub-check svg { opacity: 1; }
.sub-row .sub-title { font-size: 13px; }
.sub-row.done .sub-title { color: var(--fg-faint); text-decoration: line-through; }

/* ===== Menu nhỏ trên thẻ ===== */
.popmenu { position: fixed; z-index: 60; background: var(--surface); backdrop-filter: blur(16px); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 6px; min-width: 196px; }
.popmenu button { display: flex; align-items: center; gap: 9px; width: 100%; text-align: left; border: 0; background: transparent; color: var(--fg); font: inherit; font-size: 13.5px; padding: 10px 11px; border-radius: 9px; cursor: pointer; }
.popmenu button:hover { background: var(--surface-2); }
.popmenu button.danger { color: var(--urgent); }
.popmenu .sep { height: 1px; background: var(--border); margin: 5px 2px; }
.popmenu .label { font-size: 11px; color: var(--fg-faint); font-weight: 700; text-transform: uppercase; letter-spacing: .5px; padding: 7px 11px 3px; }

/* ===== Hộp thoại ===== */
.overlay { position: fixed; inset: 0; background: rgba(13,16,28,.55); z-index: 50; display: grid; place-items: center; padding: 16px; backdrop-filter: blur(3px); }
.modal { width: 100%; max-width: 470px; background: var(--surface); backdrop-filter: var(--glass); border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow-lg); max-height: 90vh; overflow-y: auto; }
.modal header { padding: 20px 22px 4px; display: flex; align-items: center; }
.modal header h2 { font-family: var(--title-font); font-size: 18px; margin: 0; font-weight: 700; }
.modal header .x { margin-left: auto; border: 0; background: transparent; font-size: 23px; color: var(--fg-faint); cursor: pointer; line-height: 1; }
.modal .mbody { padding: 12px 22px 22px; }
.type-pick { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.type-pick button { flex: 1 1 110px; border: 1.5px solid var(--border); background: var(--surface-2); color: var(--fg-soft); border-radius: 12px; padding: 11px 6px; font-size: 12px; font-weight: 600; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 5px; line-height: 1.2; text-align: center; }
.type-pick button .ic { font-size: 19px; }
.type-pick button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.modal label.flabel { display: block; font-size: 13px; font-weight: 600; margin: 0 0 6px; color: var(--fg-soft); }
.modal input[type=text], .modal input[type=date], .modal input[type=password], .modal textarea {
  width: 100%; padding: 11px 13px; font-size: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); color: var(--fg); font-family: inherit;
}
.modal textarea { resize: vertical; min-height: 62px; }
.modal input:focus, .modal textarea:focus { outline: 2px solid var(--accent); border-color: transparent; }
.mfield { margin-bottom: 15px; }
.sub-editor .sub-item { display: flex; gap: 8px; align-items: center; margin-bottom: 7px; }
.sub-editor .sub-item input { flex: 1; }
.sub-editor .sub-item .del { border: 0; background: var(--surface-2); color: var(--urgent); border-radius: 9px; width: 36px; height: 36px; cursor: pointer; font-size: 16px; flex: none; }
.sub-editor .add-sub { border: 1.5px dashed var(--border); background: transparent; color: var(--accent); font-weight: 600; font-size: 13px; padding: 9px; width: 100%; border-radius: 10px; cursor: pointer; margin-top: 2px; }
.modal .actions { display: flex; gap: 10px; margin-top: 18px; }
.modal .actions .btn-primary { margin-top: 0; }
.modal .actions .btn-ghost { flex: none; padding: 13px 18px; }

/* ===== Lịch tháng ===== */
.calendar { max-width: none; margin: 0; }
.cal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.cal-head .cal-title { font-family: var(--title-font); font-size: 18px; font-weight: 700; min-width: 155px; text-align: center; }
.cal-nav { width: 38px; height: 38px; border: 1px solid var(--border); background: var(--surface); border-radius: 11px; font-size: 20px; line-height: 1; color: var(--fg); cursor: pointer; }
.cal-nav:hover { background: var(--surface-2); }
.cal-today { margin-left: auto; padding: 9px 15px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 7px; }
.cal-dow-row { margin-bottom: 7px; }
.cal-dow { text-align: center; font-size: 11px; font-weight: 700; color: var(--fg-faint); text-transform: uppercase; letter-spacing: .5px; padding: 4px 0; }
.cal-cell { background: var(--surface); backdrop-filter: var(--glass); border: 1px solid var(--border); border-radius: 12px; min-height: 94px; padding: 7px; display: flex; flex-direction: column; gap: 4px; overflow: hidden; }
.cal-cell.other { background: transparent; border: 0; backdrop-filter: none; }
.cal-cell.today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.cal-day-num { font-size: 12px; font-weight: 700; color: var(--fg-soft); }
.cal-cell.today .cal-day-num { color: var(--accent); }
.cal-pill { background: var(--accent-soft); color: var(--accent); font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 7px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-pill:hover { filter: brightness(.97); }
.cal-pill.done { background: var(--done-soft); color: var(--done); text-decoration: line-through; }
.cal-pill.overdue { background: var(--urgent-soft); color: var(--urgent); }

/* ===== Hộp xác nhận tự thiết kế ===== */
.confirm-box { max-width: 380px; }
.confirm-box .mbody { padding: 24px 22px 22px; }
.confirm-title { font-family: var(--title-font); font-size: 17px; font-weight: 700; margin: 0 0 8px; }
.confirm-msg { font-size: 13.5px; color: var(--fg-soft); margin: 0; line-height: 1.5; }
.confirm-box .actions { margin-top: 20px; }
.btn-confirm { flex: 1; border: 0; border-radius: 12px; padding: 12px; font-size: 14px; font-weight: 700; color: #fff; cursor: pointer; background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.btn-confirm:hover { filter: brightness(1.05); }
.btn-confirm.danger { background: linear-gradient(135deg, #ef4444, #f97316); }
.confirm-box .actions .btn-ghost { flex: none; padding: 12px 18px; }

/* ===== Thông báo nhỏ (toast) ===== */
.toast-wrap { position: fixed; left: 0; right: 0; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); z-index: 80; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { display: flex; align-items: center; gap: 9px; background: var(--surface); color: var(--fg); border: 1px solid var(--border); box-shadow: var(--shadow-lg); border-radius: 12px; padding: 11px 15px; font-size: 13.5px; font-weight: 600; max-width: 420px; opacity: 0; transform: translateY(12px); transition: opacity .25s, transform .25s; backdrop-filter: var(--glass); }
.toast.show { opacity: 1; transform: translateY(0); }
.toast .ti { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 12px; font-weight: 800; flex: none; }
.toast.success .ti { background: var(--done); }
.toast.error .ti { background: var(--urgent); }
.toast.info .ti { background: var(--accent); }

/* ===== Nhật ký cập nhật ===== */
.last-update {
  margin-top: 9px; font-size: 11.5px; color: var(--fg-soft); font-weight: 600;
  background: var(--surface-2); border-radius: 8px; padding: 5px 9px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.last-update .lu-time { color: var(--fg-faint); }

.upd-field .upd-list { display: flex; flex-direction: column; gap: 7px; margin-bottom: 10px; }
.upd-empty { font-size: 12.5px; color: var(--fg-faint); padding: 2px 0; }
.upd-item {
  display: flex; align-items: flex-start; gap: 8px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 10px; padding: 9px 11px;
}
.upd-main { flex: 1; min-width: 0; }
.upd-text { font-size: 13px; font-weight: 600; word-break: break-word; }
.upd-time { font-size: 11px; color: var(--fg-faint); margin-top: 3px; font-variant-numeric: tabular-nums; }
.upd-acts { display: flex; gap: 2px; flex: none; }
.upd-acts button { border: 0; background: transparent; cursor: pointer; font-size: 14px; line-height: 1; padding: 4px 6px; border-radius: 7px; color: var(--fg-soft); }
.upd-acts button:hover { background: var(--surface); }
.upd-del, .upd-cancel { color: var(--urgent) !important; font-size: 17px !important; }
.upd-save { color: var(--done) !important; font-size: 15px !important; font-weight: 800; }
.upd-edit-input {
  width: 100%; padding: 7px 9px; font-size: 13px; border: 1px solid var(--accent);
  border-radius: 8px; background: var(--surface); color: var(--fg); font-family: inherit;
}
.upd-add { display: flex; gap: 8px; }
.upd-add input {
  flex: 1; min-width: 0; padding: 10px 12px; font-size: 13.5px; border: 1px solid var(--border);
  border-radius: 10px; background: var(--surface-2); color: var(--fg); font-family: inherit;
}
.upd-add input:focus { outline: 2px solid var(--accent); border-color: transparent; }
.upd-add .btn-ghost { flex: none; white-space: nowrap; }

/* ===== Hình ảnh đính kèm ===== */
.img-box { margin-top: 2px; }
.img-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.img-grid:not(:empty) { margin-bottom: 9px; }
.img-cell { position: relative; width: 74px; height: 74px; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); background: var(--surface-2); }
.img-cell img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; display: block; }
.img-cell.uploading { display: grid; place-items: center; }
.img-loading { font-size: 22px; animation: imgspin 1.2s linear infinite; }
@keyframes imgspin { to { transform: rotate(360deg); } }
.img-del { position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border: 0; border-radius: 50%; background: rgba(13,16,28,.62); color: #fff; font-size: 15px; line-height: 1; cursor: pointer; display: grid; place-items: center; }
.img-del:hover { background: var(--urgent); }
.img-zone { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; border: 1.5px dashed var(--border); border-radius: 10px; padding: 9px 12px; cursor: text; outline: none; }
.img-zone:focus { border-color: var(--accent); background: var(--accent-soft); }
.img-pick { border: 1px solid var(--border); background: var(--surface); color: var(--fg); font: inherit; font-size: 13px; font-weight: 600; padding: 7px 12px; border-radius: 9px; cursor: pointer; }
.img-pick:hover { border-color: var(--accent); color: var(--accent); }
.img-hint { font-size: 12px; color: var(--fg-faint); }

/* Ảnh trong dòng nhật ký */
.upd-item { display: block; }
.upd-row { display: flex; align-items: flex-start; gap: 8px; }
.upd-row .upd-main { flex: 1; min-width: 0; }
.upd-imgs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.upd-imgs img { width: 58px; height: 58px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); cursor: zoom-in; }
.upd-pending { margin-top: 8px; }
.upd-pending:empty, .upd-edit-imgs:empty { display: none; }

/* Chip số ảnh trên thẻ việc */
.chip.imgs { background: var(--surface-2); color: var(--fg-soft); }

/* Xem ảnh phóng to */
.img-viewer { position: fixed; inset: 0; z-index: 90; background: rgba(5,7,12,.86); display: grid; place-items: center; padding: 16px; cursor: zoom-out; }
.img-viewer img { max-width: 94vw; max-height: 92vh; width: auto; height: auto; object-fit: contain; border-radius: 10px; box-shadow: 0 20px 60px rgba(0,0,0,.6); }
.iv-close { position: fixed; top: 16px; right: 18px; width: 42px; height: 42px; border: 0; border-radius: 50%; background: rgba(255,255,255,.14); color: #fff; font-size: 24px; cursor: pointer; }
.iv-close:hover { background: rgba(255,255,255,.26); }

/* ===== Lịch gửi thông báo (loại việc "Thông báo điện thoại") ===== */
.nt-modes { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.nt-mode { border: 1.5px solid var(--border); background: var(--surface-2); color: var(--fg-soft); border-radius: 999px; padding: 7px 13px; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.nt-mode[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.nt-body { }
.nt-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13.5px; color: var(--fg-soft); }
.nt-num { width: 92px; flex: none; }
.nt-sel { width: 100px; flex: none; }
.nt-wide { flex: 1; min-width: 180px; }
.nt-dows { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.nt-dow { width: 40px; height: 36px; border: 1.5px solid var(--border); background: var(--surface-2); color: var(--fg-soft); border-radius: 9px; font-size: 12.5px; font-weight: 700; cursor: pointer; }
.nt-dow[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.chip.notify { background: var(--accent-soft); color: var(--accent); }

/* ===== Cài đặt bot Zalo ===== */
.zalo-settings { max-width: 620px; }
.zalo-settings .sec-h { font-family: var(--title-font); font-size: 19px; font-weight: 800; margin: 0 0 6px; }
.zalo-help { font-size: 13px; color: var(--fg-soft); margin: 0 0 18px; line-height: 1.6; }
.zalo-card { background: var(--surface); backdrop-filter: var(--glass); border: 1px solid var(--border); border-radius: var(--card-radius); box-shadow: var(--shadow); padding: 20px; }
.z-input { width: 100%; padding: 11px 13px; font-size: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); color: var(--fg); font-family: inherit; }
.z-input:focus { outline: 2px solid var(--accent); border-color: transparent; }
.zalo-actions { display: flex; gap: 10px; margin-top: 6px; }
.zalo-actions .btn-primary { margin-top: 0; }
.zalo-result { font-size: 13px; font-weight: 600; padding: 11px 13px; border-radius: 12px; margin-bottom: 14px; line-height: 1.5; word-break: break-word; }
.zalo-result.ok { background: var(--done-soft); color: var(--done); }
.zalo-result.err { background: var(--urgent-soft); color: var(--urgent); }

/* ===== Quản lý dự án ===== */
.proj-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.proj-head .sec-h { font-family: var(--title-font); font-size: 19px; font-weight: 800; margin: 0; margin-right: auto; }
.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.proj-card {
  position: relative; display: flex; background: var(--surface); backdrop-filter: var(--glass);
  border: 1px solid var(--border); border-radius: var(--card-radius); box-shadow: var(--shadow);
  overflow: hidden; cursor: pointer; transition: transform .12s, box-shadow .12s;
}
.proj-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.proj-stripe { width: 6px; flex: none; background: var(--pc); }
.proj-card-body { flex: 1; min-width: 0; padding: 14px 16px; }
.proj-card-top { display: flex; align-items: center; gap: 8px; }
.proj-name { font-family: var(--title-font); font-weight: 700; font-size: 15.5px; flex: 1; min-width: 0; word-break: break-word; }
.proj-card .menu-btn { margin-left: auto; }
.proj-note { font-size: 12.5px; color: var(--fg-soft); margin-top: 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.proj-dates { font-size: 12px; color: var(--fg-faint); margin-top: 8px; font-weight: 600; }
.proj-card .progress-wrap { margin-top: 12px; }

/* Chấm/nhãn màu dự án trên thẻ việc */
.chip.proj { background: color-mix(in srgb, var(--pc) 16%, transparent); color: var(--pc); }
.proj-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--pc); display: inline-block; flex: none; }
.proj-dot.big { width: 11px; height: 11px; }

/* Trang chi tiết dự án */
.pd-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.pd-name { font-family: var(--title-font); font-weight: 800; font-size: 18px; display: flex; align-items: center; gap: 9px; }
.pd-note { font-size: 13px; color: var(--fg-soft); margin: 4px 0 0; }
.pd-progress { display: flex; align-items: center; gap: 10px; margin: 14px 0 22px; max-width: 460px; }

/* Bộ chọn màu dự án */
.color-pick { display: flex; gap: 9px; flex-wrap: wrap; }
.color-pick .sw { width: 30px; height: 30px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; padding: 0; }
.color-pick .sw.on { border-color: var(--fg); }

/* Hàng 2 cột trong hộp thoại + ô chọn */
.mfield.two-col { display: flex; gap: 12px; }
.mfield.two-col > div { flex: 1; min-width: 0; }
.m-select {
  width: 100%; padding: 11px 13px; font-size: 14px; border: 1px solid var(--border);
  border-radius: 12px; background: var(--surface-2); color: var(--fg); font-family: inherit;
}
.m-select:focus { outline: 2px solid var(--accent); border-color: transparent; }

/* Màn hình hẹp: sidebar thu lại thành ngăn kéo trượt */
@media (max-width: 860px) {
  .sidebar {
    position: fixed; top: 0; left: 0; height: 100vh; width: 272px;
    transform: translateX(-100%); transition: transform .25s ease; box-shadow: var(--shadow-lg);
    padding-top: calc(18px + env(safe-area-inset-top, 0px));
  }
  .sidebar.open { transform: translateX(0); }
  .hamburger { display: grid; place-items: center; }
}

@media (max-width: 720px) {
  .kanban { grid-template-columns: 1fr; gap: 12px; }
  .card .drag-handle { display: none; }
  .brand h1 { font-size: 17px; }
  .greet { font-size: 18px; }
  .cal-grid { gap: 3px; }
  .cal-cell { min-height: 64px; padding: 3px; border-radius: 8px; }
  .cal-day-num { font-size: 11px; }
  .cal-pill { font-size: 9.5px; padding: 1px 4px; }
  .cal-head .cal-title { font-size: 16px; min-width: 0; flex: 1; }
}
