﻿/* LiveToDo — giao diện bản 3.1. Tông giấy trung tính, chữ Roboto (public/fonts), một màu nhấn (= màu không gian làm việc, gán bằng JS).
 * Quy ước: không gradient, không bóng đổ nặng; phân cấp bằng cỡ chữ, độ đậm và đường kẻ mảnh. */
@font-face { font-family: "Roboto"; src: url(/fonts/Roboto-Regular.ttf) format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Roboto"; src: url(/fonts/Roboto-Medium.ttf) format("truetype"); font-weight: 500 600; font-display: swap; }
@font-face { font-family: "Roboto"; src: url(/fonts/Roboto-Bold.ttf) format("truetype"); font-weight: 700 900; font-display: swap; }

/* 3 bảng màu (data-theme trên <html>, chọn trong "Máy này & tài khoản"). Chung: nền xám rõ, ô trắng có viền + bóng nhẹ,
 * cột trái tối, nút chính + logo màu nâu đất (--ink). Tham khảo: Linear / Notion (than chì), Jira / Asana (xanh than). */
:root, [data-theme="dat"] {
  --bg: #e8e3da; --surface: #ffffff; --soft: #f7f4ef; --side: #2b231d;
  --line: #d5ccbf; --line2: #e7e1d7; --hover: #f2eee8;
  --text: #221d18; --muted: #6b6157; --faint: #9c9186;
  --side-text: #f1e9de; --side-muted: #c3b5a3; --side-faint: #8e7f6d; --side-hover: rgba(255,255,255,.07); --side-on: rgba(255,255,255,.13); --side-line: rgba(255,255,255,.1);
}
[data-theme="than"] {
  --bg: #e6e8eb; --surface: #ffffff; --soft: #f5f6f8; --side: #1f2328;
  --line: #d2d6dc; --line2: #e3e6ea; --hover: #eef0f3;
  --text: #1c1f23; --muted: #5c636d; --faint: #949ba5;
  --side-text: #eceef1; --side-muted: #a9b0ba; --side-faint: #7a818b; --side-hover: rgba(255,255,255,.07); --side-on: rgba(255,255,255,.13); --side-line: rgba(255,255,255,.09);
}
[data-theme="navy"] {
  --bg: #e4e9f0; --surface: #ffffff; --soft: #f4f6fa; --side: #15263d;
  --line: #cbd4e0; --line2: #e0e6ee; --hover: #edf1f6;
  --text: #17202c; --muted: #566275; --faint: #8e99aa;
  --side-text: #e9eef5; --side-muted: #a7b4c6; --side-faint: #7586a0; --side-hover: rgba(255,255,255,.07); --side-on: rgba(255,255,255,.14); --side-line: rgba(255,255,255,.1);
}
:root {
  --ink: #3f2d21; --ink-h: #57402f; --side-logo: #b48659;   /* nâu đất: nút chính, logo */
  --card-shadow: 0 1px 2px rgba(20,16,12,.06), 0 1px 4px rgba(20,16,12,.04);
  --accent: #2b59c3; --accent-bg: #eef2fb;
  --red: #c0392b; --red-bg: #fbefed; --amber: #b06a00; --amber-bg: #fbf3e3; --green: #1d7a45; --green-bg: #ebf5ee;
  --info: #3b5f9e; --info-bg: #eef2f8;
  --radius: 8px; --shadow: 0 1px 2px rgba(29,28,26,.05); --shadow-lg: 0 18px 48px rgba(29,28,26,.18), 0 2px 6px rgba(29,28,26,.06);
  --side-w: 272px; --panel-w: 480px;
  font-family: "Roboto", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  font-size: 14px; line-height: 1.45; color: var(--text); background: var(--bg);
  font-feature-settings: "tnum" 0;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { overflow: hidden; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
b, strong { font-weight: 500; }
.hide { display: none !important; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.grow { flex: 1; }
.num { font-variant-numeric: tabular-nums; }
.red { color: var(--red); } .amber { color: var(--amber); } .green { color: var(--green); }
.pad4 { padding: 2px 4px; }
kbd { font: 11px/1 ui-monospace, Consolas, monospace; padding: 3px 5px; border: 1px solid var(--line); border-radius: 4px; background: var(--soft); color: var(--muted); }
::selection { background: color-mix(in srgb, var(--accent) 22%, #fff); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #d6d3cc; border-radius: 10px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #bfbbb2; background-clip: content-box; border: 3px solid transparent; }

/* ---------- nút, ô nhập ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border: 1px solid var(--line); background: var(--surface);
  border-radius: 7px; font-weight: 500; white-space: nowrap; flex: none; color: var(--text); transition: background .12s, border-color .12s; }
.btn:hover { background: var(--hover); border-color: #d2cfc7; text-decoration: none; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.primary:hover { background: var(--ink-h); border-color: var(--ink-h); }
.btn.danger { color: var(--red); }
.btn.danger:hover { background: var(--red-bg); border-color: #efc9c3; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--hover); }
.btn.sm { height: 30px; padding: 0 11px; font-size: 13px; }
.btn.wide { width: 100%; justify-content: center; height: 42px; font-size: 14.5px; }
.ib { width: 32px; height: 32px; display: inline-grid; place-items: center; border: 0; background: transparent; border-radius: 7px; color: var(--muted); flex: none; font-size: 17px; line-height: 1; }
.ib:hover { background: var(--hover); color: var(--text); }
.ib svg, .btn svg { width: 16px; height: 16px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=time], input[type=number], input[type=tel], input:not([type]), select, textarea {
  height: 36px; padding: 0 11px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); outline: none; min-width: 0; transition: border-color .12s, box-shadow .12s; }
input::placeholder, textarea::placeholder { color: #b0aca3; }
textarea { height: auto; padding: 9px 11px; resize: vertical; line-height: 1.55; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent); }
select { padding-right: 28px; appearance: none; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%2367645d' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 11px center; }
input[type=checkbox] { accent-color: var(--ink); width: 16px; height: 16px; margin: 0; }
.seg { display: inline-flex; background: var(--line2); border-radius: 8px; padding: 3px; flex: none; }
.seg button { border: 0; background: transparent; height: 28px; padding: 0 13px; border-radius: 6px; font-weight: 500; color: var(--muted); white-space: nowrap; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(29,28,26,.1); }
.badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; font-size: 11.5px; font-weight: 500; background: var(--line2); color: var(--muted); font-variant-numeric: tabular-nums; }
.badge.red { background: var(--red); color: #fff; } .badge.amber { background: var(--amber); color: #fff; }
.tag { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 4px; font-size: 12px; font-weight: 500; white-space: nowrap; background: var(--line2); color: var(--muted); }
.tag.red { background: var(--red-bg); color: var(--red); } .tag.amber { background: var(--amber-bg); color: var(--amber); }
.tag.info { background: var(--info-bg); color: var(--info); } .tag.green, .tag.ok { background: var(--green-bg); color: var(--green); }
.tag.soft { background: transparent; color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); }
.tag.ok::before { content: ""; width: 7px; height: 4px; border: 1.6px solid currentColor; border-top: 0; border-right: 0; transform: rotate(-45deg) translateY(-1px); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.dot.red { background: var(--red); } .dot.amber { background: var(--amber); } .dot.info { background: var(--info); }
/* chữ xanh "Đã hoàn thành" */
.okt { display: inline-flex; align-items: center; gap: 4px; margin-left: 8px; font-size: 12px; font-weight: 500; color: var(--green); text-decoration: none !important; white-space: nowrap; vertical-align: 1px; }
.okt::before { content: ""; width: 7px; height: 4px; border: 1.8px solid currentColor; border-top: 0; border-right: 0; transform: rotate(-45deg) translateY(-1px); }

/* ---------- đăng nhập ---------- */
.login { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); }
.login { overflow-y: auto; padding: 24px 0; }
.lcard { width: 390px; max-width: calc(100vw - 32px); background: var(--surface); padding: 36px 34px 26px; border-radius: 12px; border: 1px solid var(--line); box-shadow: 0 24px 60px rgba(29,28,26,.08); display: grid; gap: 16px; }
.lstep { display: grid; gap: 14px; }
.login p { margin: 0; line-height: 1.5; }
.login .lsub { margin-top: -8px; }
.login label { display: grid; gap: 7px; font-weight: 500; font-size: 13px; color: var(--muted); }
.login input:not([type=checkbox]) { height: 42px; }
.login .err { color: var(--red); min-height: 18px; font-size: 13px; margin-top: -6px; }
.login .ckline { display: flex; align-items: center; gap: 9px; font-weight: 400; color: var(--text); cursor: pointer; }
#otpCode { font-size: 22px; letter-spacing: 8px; text-align: center; font-variant-numeric: tabular-nums; }
.lnote { color: var(--muted); font-size: 13.5px; }
.lfoot { text-align: center; font-size: 13px; color: var(--muted); }
.lfoot .sep { margin: 0 8px; color: var(--faint); }
.lmsg { padding: 11px 13px; border-radius: 8px; background: var(--green-bg); color: var(--green); font-size: 13.5px; line-height: 1.5; }
.lmsg.bad { background: var(--red-bg); color: var(--red); }
.gbtn { gap: 10px; }
.gmark { width: 18px; height: 18px; flex: none; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Cpath fill='%23EA4335' d='M24 9.5c3.5 0 6.6 1.2 9 3.5l6.7-6.7C35.6 2.4 30.2 0 24 0 14.6 0 6.6 5.4 2.6 13.3l7.8 6C12.3 13.6 17.6 9.5 24 9.5z'/%3E%3Cpath fill='%234285F4' d='M46.5 24.5c0-1.6-.1-3.1-.4-4.5H24v9h12.7c-.6 3-2.3 5.5-4.8 7.2l7.5 5.8c4.4-4.1 7.1-10.1 7.1-17.5z'/%3E%3Cpath fill='%23FBBC05' d='M10.4 28.7c-.5-1.4-.8-3-.8-4.7s.3-3.3.8-4.7l-7.8-6C.9 16.6 0 20.2 0 24s.9 7.4 2.6 10.7l7.8-6z'/%3E%3Cpath fill='%2334A853' d='M24 48c6.5 0 11.9-2.1 15.9-5.8l-7.5-5.8c-2.1 1.4-4.9 2.3-8.4 2.3-6.4 0-11.7-4.1-13.6-9.8l-7.8 6C6.6 42.6 14.6 48 24 48z'/%3E%3C/svg%3E") center/contain no-repeat; }

/* ---------- chuông thông báo ---------- */
.bellbtn { position: relative; }
.bellbtn svg { width: 18px; height: 18px; }
.bdot { position: absolute; top: 2px; right: 1px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--red); color: #fff;
  font-size: 10.5px; font-weight: 500; line-height: 16px; text-align: center; font-variant-numeric: tabular-nums; }
.npop { position: fixed; z-index: 60; width: 380px; max-width: calc(100vw - 16px); max-height: min(560px, calc(100vh - 80px)); display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg); overflow: hidden; }
.nph, .npf { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line2); }
.npf { border-bottom: 0; border-top: 1px solid var(--line2); justify-content: center; }
.npl { overflow-y: auto; flex: 1; }
.npl .empty-s { margin: 18px; }
.nrow { display: flex; gap: 11px; padding: 11px 14px; cursor: pointer; border-bottom: 1px solid var(--line2); }
.nrow:hover { background: var(--hover); }
.nrow .grow { min-width: 0; display: grid; gap: 2px; }
.nrow b { font-weight: 400; color: var(--muted); overflow-wrap: anywhere; }
.nrow.new b { font-weight: 500; color: var(--text); }
.nrow span:not(.nic) { font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
.nrow small { font-size: 11.5px; color: var(--faint); }
.nic { width: 28px; height: 28px; border-radius: 7px; background: var(--line2); color: var(--muted); display: grid; place-items: center; flex: none; }
.nrow.new .nic { background: var(--ink); color: #fff; }
.nic svg { width: 15px; height: 15px; }
.lnk { border: 0; background: none; color: var(--accent); padding: 0; font-weight: 500; font-size: 13px; }
.lnk:hover { text-decoration: underline; }

/* ---------- máy này, phiên, quản trị hệ thống ---------- */
.aic { width: 32px; height: 32px; border-radius: 8px; background: var(--line2); display: grid; place-items: center; color: var(--muted); flex: none; }
.aic svg { width: 17px; height: 17px; }
.sesl, .bkl { display: grid; border: 1px solid var(--line2); border-radius: 8px; overflow: hidden; }
.sesl .ln, .bkl .ln { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--line2); }
.sesl .ln:last-child, .bkl .ln:last-child { border-bottom: 0; }
.sesl small, .bkl small { display: block; font-size: 12px; color: var(--faint); margin-top: 2px; overflow-wrap: anywhere; }
.sesl .grow, .bkl .grow { min-width: 0; }
.sysp .ch2 svg { width: 17px; height: 17px; vertical-align: -3px; margin-right: 4px; }
.sysp .setf small { font-weight: 400; }
.sysp .arow .tag { flex: none; }
.warnc { border-color: #ecd3a5; background: var(--amber-bg); }
.t-amber { color: var(--amber); font-weight: 500; }
.sm2 { font-size: 12px; font-weight: 400; }
.actlog { max-height: 420px; overflow: auto; border: 1px solid var(--line2); border-radius: 8px; }
.tb.sm td { padding: 7px 10px; font-size: 12.5px; }
.ell { max-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sw { position: relative; width: 40px; height: 22px; flex: none; cursor: pointer; }
.sw input { position: absolute; opacity: 0; inset: 0; margin: 0; width: 100%; height: 100%; cursor: pointer; }
.sw i { position: absolute; inset: 0; border-radius: 11px; background: #d6d3cc; transition: background .15s; pointer-events: none; }
.sw i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.sw input:checked + i { background: var(--green); }
.sw input:checked + i::after { transform: translateX(18px); }
.sw input:disabled + i { opacity: .45; }
.file.gone { opacity: .6; cursor: default; }
.file.gone span { font-size: 11.5px; }
.chatch { display: inline-flex; align-items: center; gap: 5px; }
.chatch svg { width: 14px; height: 14px; color: var(--muted); }
.offbar { position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 70; max-width: calc(100vw - 24px);
  padding: 9px 16px; border-radius: 8px; background: var(--text); color: #fff; font-size: 13px; font-weight: 500; box-shadow: var(--shadow-lg); text-align: center; }
body.offline #newJob, body.offline #quickBox { opacity: .45; pointer-events: none; }
.cronl { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.cronl code { font: 11.5px/1.5 ui-monospace, Consolas, monospace; background: var(--soft); padding: 1px 5px; border-radius: 4px; user-select: all; }
.sysp .arow, .warnc .arow, .dlg .arow { flex-wrap: wrap; }
.sysp .arow .grow, .warnc .arow .grow, .dlg .arow .grow { flex: 1 1 220px; }
.sysp .arow .grow b, .dlg .arow .grow b { white-space: normal; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; letter-spacing: -.2px; }
.brand.big { font-size: 24px; letter-spacing: -.5px; }
.logo { width: 24px; height: 24px; border-radius: 6px; background: var(--ink); position: relative; flex: none; }
.brand.big .logo { width: 30px; height: 30px; border-radius: 8px; }
.logo::after { content: ""; position: absolute; left: 30%; top: 30%; width: 40%; height: 22%; border: 2.4px solid #fff; border-top: 0; border-right: 0; transform: rotate(-45deg); }

/* ---------- khung 3 cột ---------- */
.app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr) var(--panel-w); height: 100vh; }
.app.nopanel { grid-template-columns: var(--side-w) minmax(0, 1fr) 0; }
.side { background: var(--side); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; padding: 16px 12px 10px; gap: 2px; overflow-y: auto; overflow-x: hidden; }
.side .brand { padding: 2px 8px 16px; }
.sec-h { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px 4px; font-size: 11.5px; font-weight: 500; color: var(--faint); letter-spacing: .2px; }
.sec-h .ib { width: 24px; height: 24px; font-size: 16px; }
.cos { display: grid; gap: 1px; }
.co { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 8px; border-radius: 7px; cursor: pointer; font-weight: 500; color: var(--muted); }
.co:hover { background: rgba(29,28,26,.05); color: var(--text); }
.co.on { background: var(--surface); color: var(--text); box-shadow: 0 0 0 1px var(--line), 0 1px 2px rgba(29,28,26,.05); }
.co .sq { width: 22px; height: 22px; border-radius: 5px; display: grid; place-items: center; color: #fff; font-size: 10.5px; font-weight: 700; flex: none; }
.co .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.co .more { opacity: 0; width: 24px; height: 24px; font-size: 15px; }
.co:hover .more { opacity: 1; }
.nav { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.nav a { position: relative; min-width: 0; display: flex; align-items: center; gap: 11px; height: 36px; padding: 0 10px; border-radius: 7px; color: #4a4741; font-weight: 400; }
.nav a:hover { background: rgba(29,28,26,.05); color: var(--text); text-decoration: none; }
.nav a svg { width: 17px; height: 17px; flex: none; color: var(--faint); }
.nav a.on { background: var(--surface); color: var(--text); font-weight: 500; box-shadow: 0 0 0 1px var(--line); }
.nav a.on svg { color: var(--accent); }
.nav a span:not(.badge) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav a .badge { margin-left: auto; }
.nav.lists { margin-top: 8px; padding-top: 8px; }
.nav.lists a .more { width: 22px; height: 22px; opacity: 0; margin-left: -4px; }
.nav.lists a:hover .more { opacity: 1; }
.addlist { height: 34px; border: 0; background: none; color: var(--muted); font-weight: 400; text-align: left; padding: 0 10px; border-radius: 7px; }
.addlist:hover { background: rgba(29,28,26,.05); color: var(--text); }
.me { display: flex; align-items: center; gap: 10px; padding: 12px 8px 4px; margin-top: auto; border-top: 1px solid var(--line); }
.av { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); font-weight: 500; font-size: 12px; flex: none; color: var(--muted); }
.me .who { flex: 1; min-width: 0; line-height: 1.3; }
.me .who b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me .who span { font-size: 12px; color: var(--muted); }
.sq { width: 26px; height: 26px; border-radius: 6px; display: grid; place-items: center; color: #fff; font-size: 11px; font-weight: 700; flex: none; }

/* ---------- cột trái tối (bản 4.1) ---------- */
.side { color: var(--side-text); border-right-color: transparent; }
.side .brand { color: #fff; }
.side .logo { background: var(--side-logo); }
.side .sec-h { color: var(--side-faint); text-transform: uppercase; letter-spacing: .4px; font-size: 11.5px; font-weight: 600; }
.side .co { font-size: 14.5px; }
.side .ib { color: var(--side-muted); }
.side .ib:hover { background: var(--side-hover); color: #fff; }
.side .co { color: var(--side-muted); }
.side .co:hover { background: var(--side-hover); color: #fff; }
.side .co.on { background: var(--side-on); color: #fff; box-shadow: none; }
.side .nav { border-top-color: var(--side-line); }
.side .nav a { color: var(--side-muted); }
.side .nav a:hover { background: var(--side-hover); color: #fff; }
.side .nav a svg { color: var(--side-faint); }
.side .nav a.on { background: var(--side-on); color: #fff; box-shadow: inset 3px 0 0 var(--side-logo); }
.side .nav a.on svg, .side .nav a:hover svg { color: #fff; }
.side .badge:not(.red):not(.amber) { background: rgba(255,255,255,.14); color: var(--side-text); }
.side .addlist { color: var(--side-faint); }
.side .addlist:hover { background: var(--side-hover); color: #fff; }
.side .me { border-top-color: var(--side-line); }
.side .av { background: rgba(255,255,255,.1); box-shadow: none; color: var(--side-text); }
.side .me .who span { color: var(--side-faint); }
/* menu chính: chữ HOA, dài thì xuống 2 dòng */
.nav:not(.lists) a { height: auto; min-height: 42px; padding: 8px 11px; text-transform: uppercase; font-size: 13.5px; letter-spacing: .15px; font-weight: 600; line-height: 1.3; }
.nav a svg { width: 18px !important; height: 18px !important; }
.nav.lists a { font-size: 14.5px; min-height: 38px; }
.side .me .who b { font-size: 14.5px; }
.nav:not(.lists) a span:not(.badge) { white-space: normal; overflow: visible; }
.nav.lists a { color: var(--side-muted); }

/* ô / khung tách khỏi nền */
.trow, .kpi, .card, .ledger, .cal, .mcal, .tbwrap { box-shadow: var(--card-shadow); }
.top { box-shadow: 0 1px 0 var(--line); }

/* ---------- Hợp đồng, hoá đơn, chứng từ: khu ưu tiên ---------- */
.paperp .psec:first-child { margin-top: 0; }
.psec { margin-top: 20px; border-radius: 12px; border: 1px solid; overflow: hidden; box-shadow: var(--card-shadow); }
.psh { display: flex; align-items: center; gap: 13px; padding: 13px 16px; border-bottom: 1px solid; }
.psi { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; color: #fff; flex: none; }
.psi svg { width: 18px; height: 18px; }
.pst { flex: 1; min-width: 0; }
.pst h2 { margin: 0 !important; font-size: 15px; text-transform: uppercase; letter-spacing: .6px; font-weight: 700; }
.pst span { font-size: 12.5px; color: var(--muted); }
.pcount { min-width: 30px; height: 30px; padding: 0 8px; border-radius: 15px; display: grid; place-items: center; font-weight: 700; color: #fff; font-variant-numeric: tabular-nums; }
.psec .tlist { padding: 10px; }
.ps-contract { border-color: #efbcb6; background: #fdf3f2; } .ps-contract .psh { background: #fadcd8; border-color: #f3c8c2; box-shadow: inset 5px 0 0 #b42318; }
.ps-contract .psi, .ps-contract .pcount { background: #b42318; } .ps-contract h2 { color: #8f1c13; } .ps-contract .trow { border-left: 3px solid #d9534a; }
.ps-invoice { border-color: #efcf9e; background: #fdf7ec; } .ps-invoice .psh { background: #f9e6c4; border-color: #f2d9ad; box-shadow: inset 5px 0 0 #b25e09; }
.ps-invoice .psi, .ps-invoice .pcount { background: #b25e09; } .ps-invoice h2 { color: #8a4806; } .ps-invoice .trow { border-left: 3px solid #e09a3e; }
.ps-other { border-color: #bccbe8; background: #f3f6fc; } .ps-other .psh { background: #dfe7f6; border-color: #cdd9ef; box-shadow: inset 5px 0 0 #2e5aac; }
.ps-other .psi, .ps-other .pcount { background: #2e5aac; } .ps-other h2 { color: #22437f; } .ps-other .trow { border-left: 3px solid #6c8fd0; }
.paperp .trow.lv-red, .paperp .trow.lv-amber { box-shadow: var(--card-shadow); }
.paperp .trow.on { box-shadow: 0 0 0 2px var(--ink), 0 4px 14px rgba(40,28,18,.14); }
.paperp .dgrp { margin-top: 18px; }
.dchips { display: flex; flex-wrap: wrap; gap: 5px; }
.dchip { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 12px; font-size: 12px; font-weight: 500; border: 1px solid; white-space: nowrap; }
.dchip svg { width: 12px; height: 12px; }
.dchip i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: block; }
.dchip.ok { background: #e7f4ec; border-color: #b9dcc6; color: #17683b; }
.dchip.red { background: #fde8e6; border-color: #f2b8b2; color: #b42318; }
.dchip.amber { background: #fdf1de; border-color: #f0d09e; color: #9a5208; }
.dchip.todo { background: #eef2fa; border-color: #c9d5ee; color: #2e5aac; }
.dchip.wait { background: var(--soft); border-color: var(--line); color: var(--faint); }

/* ---------- Cộng tác viên ---------- */
.ctvf { margin-top: 16px; flex-wrap: wrap; gap: 8px; }
.ctvf input { width: 240px; max-width: 100%; } .ctvf select { width: auto; }
.skl { display: flex; flex-wrap: wrap; gap: 4px; }
.skl .tag { height: 20px; font-size: 11.5px; }
.rate { display: inline-flex; gap: 2px; }
.rate i { width: 9px; height: 9px; border-radius: 2px; background: var(--line); transform: rotate(45deg); display: block; margin: 0 1px; }
.rate i.on { background: #c8902e; }
.ctvtop { margin-top: 16px; }
.tbar { display: grid; grid-template-columns: minmax(150px, 230px) minmax(0, 1fr) 120px; gap: 12px; align-items: center; padding: 7px 12px; border-radius: 7px; cursor: pointer; }
.tbar:hover { background: var(--soft); }
.tbar .tn b { font-weight: 500; } .tbar .tn small { display: block; font-size: 11.5px; color: var(--faint); }
.tb2 { height: 10px; background: var(--line2); border-radius: 5px; overflow: hidden; }
.tb2 i { display: block; height: 100%; background: linear-gradient(90deg, #4fa874, #1d7a45); border-radius: 5px; }
.tbar .tv { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; color: #17683b; }
.ctvstat { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; margin-bottom: 14px; }
.ctvstat > div { background: var(--soft); border: 1px solid var(--line2); border-radius: 8px; padding: 9px 11px; }
.ctvstat small { display: block; font-size: 11.5px; color: var(--muted); }
.ctvstat b { font-size: 15px; font-variant-numeric: tabular-nums; }
@media (max-width: 760px) { .tbar { grid-template-columns: minmax(0, 1fr) 100px; } .tbar .tb2 { display: none; } }

/* ---------- Báo cáo ---------- */
.rkpis { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.kpi.rk .grs { display: grid; gap: 2px; margin-top: 8px; }
.gr { font-size: 11.5px; font-weight: 500; font-variant-numeric: tabular-nums; }
.gr.up { color: var(--green); } .gr.down { color: var(--red); } .gr.flat { color: var(--faint); }
.kv .gr { margin-left: 8px; }
.rgrid { margin-top: 16px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.cash { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding: 6px 12px 12px; }
.cash > div { border-radius: 10px; padding: 12px 13px; border: 1px solid; }
.cash small { display: flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 500; }
.cash small svg { width: 14px; height: 14px; }
.cash b { display: block; font-size: 18px; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.cash span { font-size: 11.5px; color: var(--muted); }
.cin { background: #eef7f1; border-color: #b7dcc4 !important; color: #17683b; }
.cout { background: #fdf1ea; border-color: #efc6b0 !important; color: #b0451c; }
.cnet { background: var(--soft); border-color: var(--line) !important; }
.cnet.pos b { color: var(--green); } .cnet.neg b { color: var(--red); }
.kv.ytd { padding: 4px 12px 12px; }
.rchart { margin-top: 16px; }
.chart.c12 { gap: 6px; height: 210px; }
.chart.c12 .bars i { width: 28%; max-width: 14px; }
.chart .bars i.rv, .legend i.rv { background: #3f5f8f; }
.chart .bars i.co, .legend i.co { background: #e08a5f; }
.chart .bars i.pf, .legend i.pf { background: #1d7a45; }
.chart .lb.cur { color: var(--ink); font-weight: 700; }
.hbars { display: grid; gap: 8px; padding: 6px 12px 10px; }
.hb { display: grid; grid-template-columns: minmax(110px, 38%) minmax(0, 1fr) 128px; gap: 10px; align-items: center; font-size: 13px; }
.hl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbb { height: 10px; background: var(--line2); border-radius: 5px; overflow: hidden; }
.hbb i { display: block; height: 100%; border-radius: 5px; background: #3f5f8f; }
.hbb i.out { background: #e08a5f; } .hbb i.in { background: #4fa874; }
.hv { text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; }
.hv small { display: block; font-size: 11px; color: var(--faint); font-weight: 400; }
@media (max-width: 900px) { .rgrid { grid-template-columns: minmax(0, 1fr); } .cash { grid-template-columns: minmax(0, 1fr); } .hb { grid-template-columns: minmax(0, 1fr) 110px; } .hbb { display: none; } }

/* chọn bảng màu */
.themes { display: flex; gap: 8px; flex-wrap: wrap; }
.thm { display: grid; gap: 5px; justify-items: center; padding: 6px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); font-size: 12px; color: var(--muted); }
.thm i { width: 64px; height: 36px; border-radius: 6px; display: block; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.thm.on { border-color: var(--ink); box-shadow: 0 0 0 2px color-mix(in srgb, var(--ink) 25%, transparent); color: var(--text); font-weight: 500; }

/* ---------- Công nợ: Khoản thu (xanh) / Khoản chi (đỏ cam) ---------- */
.kpi .l svg { width: 15px; height: 15px; vertical-align: -2px; margin-right: 5px; }
.kpi.kin { background: #eef7f1; border-color: #b7dcc4; } .kpi.kin .v, .kpi.kin .l { color: #17683b; }
.kpi.kout { background: #fdf1ea; border-color: #efc6b0; } .kpi.kout .v, .kpi.kout .l { color: #b0451c; }
.kpi.kred .v { color: var(--red); }
.ledger { margin-top: 22px; border-radius: 12px; border: 1px solid; overflow: hidden; }
.ledger.in { border-color: #b7dcc4; background: #f3faf5; }
.ledger.out { border-color: #efc6b0; background: #fdf6f1; }
.lgh { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 14px 18px; border-bottom: 1px solid; }
.ledger.in .lgh { background: #e3f2e8; border-color: #c8e5d2; box-shadow: inset 5px 0 0 #1d7a45; }
.ledger.out .lgh { background: #fbe5d9; border-color: #f3d2c1; box-shadow: inset 5px 0 0 #c4521f; }
.lgi { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: #fff; flex: none; }
.ledger.in .lgi { background: #1d7a45; } .ledger.out .lgi { background: #c4521f; }
.lgi svg { width: 19px; height: 19px; }
.lgt { flex: 1 1 260px; min-width: 0; }
.lgt h2 { margin: 0 !important; font-size: 16px; text-transform: uppercase; letter-spacing: .6px; font-weight: 700; }
.ledger.in .lgt h2 { color: #145c33; } .ledger.out .lgt h2 { color: #9c3b14; }
.lgt span { font-size: 12.5px; color: var(--muted); }
.lgsum { text-align: right; line-height: 1.25; }
.lgsum small { display: block; font-size: 11.5px; color: var(--muted); }
.lgsum b { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ledger.in .lgsum b { color: #17683b; } .ledger.out .lgsum b { color: #b0451c; }
.lgbtn { background: #fff; }
.ledger.in .lgbtn { border-color: #9fd0b1; color: #17683b; } .ledger.out .lgbtn { border-color: #eab79c; color: #a6411a; }
.lgb { padding: 12px; }
.ledger.in .trow { border-left: 3px solid #4fa874; } .ledger.out .trow { border-left: 3px solid #e08a5f; }
.amt-in { color: #17683b; } .amt-out { color: #b0451c; }
.trow.done .amt-in, .trow.done .amt-out { color: var(--muted); }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.top { display: flex; align-items: center; gap: 8px; height: 60px; padding: 0 20px; border-bottom: 1px solid var(--line); background: var(--surface); flex: none; }
.top > * { flex: none; }
.top h1 { font-size: 19px; font-weight: 700; margin: 0 8px 0 0; white-space: nowrap; letter-spacing: -.3px; }
.calctl { display: flex; align-items: center; gap: 2px; }
.calctl .range { font-weight: 500; font-size: 15px; margin-left: 10px; white-space: nowrap; color: var(--muted); }
.calctl .btn { margin-left: 4px; }
.calctl.list-mode #prev, .calctl.list-mode #next { display: none; }
.top .grow { flex: 1 1 0; min-width: 0; }
.quick { flex: 0 1 360px !important; min-width: 150px; }
.quick input { width: 100%; height: 34px; background: var(--soft); }
.ic-search { width: 13px; height: 13px; border: 1.8px solid currentColor; border-radius: 50%; position: relative; display: inline-block; }
.ic-search::after { content: ""; position: absolute; width: 1.8px; height: 6px; background: currentColor; right: -4px; bottom: -5px; transform: rotate(-45deg); }
.only-m { display: none; }
.view { flex: 1; min-height: 0; overflow: auto; position: relative; }

/* chip tháng sắp tới */
.mbar { display: flex; gap: 6px; padding: 10px 20px; overflow-x: auto; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 3; align-items: center; scrollbar-width: thin; }
.mchip { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 12px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); font-weight: 500; font-size: 13px; color: var(--muted); white-space: nowrap; flex: none; }
.mchip b { font-size: 11.5px; font-weight: 500; min-width: 18px; height: 18px; border-radius: 9px; background: var(--line2); display: grid; place-items: center; padding: 0 5px; color: var(--text); }
.mchip:hover { border-color: #cfccc4; color: var(--text); }
.mchip.on { background: var(--text); border-color: var(--text); color: #fff; }
.mchip.on b { background: rgba(255,255,255,.2); color: #fff; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }

/* ---------- lịch tháng (42 ngày) ---------- */
.month { display: flex; flex-direction: column; min-height: 100%; background: var(--surface); }
.month .dow { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-bottom: 1px solid var(--line); position: sticky; top: 51px; background: var(--surface); z-index: 2; }
.month .dow div { padding: 9px 12px; font-size: 12px; font-weight: 500; color: var(--faint); }
.month .wk { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); flex: 1 0 auto; min-height: 116px; border-bottom: 1px solid var(--line2); }
.cell { border-right: 1px solid var(--line2); padding: 6px 6px 8px; min-width: 0; display: flex; flex-direction: column; gap: 4px; cursor: default; position: relative; }
.cell:nth-child(7n) { border-right: 0; }
.cell.we:not(.past) { background: #fcfbf9; }
.cell.past { background: #f7f6f3; }
.cell.past .dn { color: #bdb9b0; }
.cell.past .ev { opacity: .55; }
.cell.has:not(.past) { background: color-mix(in srgb, var(--accent) 4%, #fff); }
.cell.sel { box-shadow: inset 0 0 0 1.5px var(--accent); z-index: 1; }
.cell.drop { background: var(--accent-bg); }
.cell .ch { display: flex; align-items: center; gap: 6px; height: 24px; padding: 0 2px; }
.cell .dn { font-weight: 500; font-size: 13px; min-width: 24px; height: 24px; padding: 0 6px; display: grid; place-items: center; border-radius: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.cell.has:not(.past) .dn { color: var(--text); font-weight: 700; }
.cell.today .dn { background: var(--accent); color: #fff !important; font-weight: 700; }
.cell .cnt { font-size: 11.5px; color: var(--faint); }
.cell .add { margin-left: auto; opacity: 0; width: 24px; height: 24px; font-size: 16px; }
.cell:hover .add { opacity: 1; }
.cell .dnote { font-size: 12px; color: var(--muted); padding: 2px 7px; border-left: 2px solid #d9c98a; background: #fbf8ec; border-radius: 2px;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; cursor: pointer; }

/* chip job trong ô */
.ev { position: relative; border-radius: 5px; padding: 5px 8px 5px 10px; background: var(--surface); border: 1px solid var(--line); cursor: pointer; min-width: 0; line-height: 1.3;
  box-shadow: 0 1px 1px rgba(29,28,26,.03); }
.ev::before { content: ""; position: absolute; left: -1px; top: -1px; bottom: -1px; width: 3px; border-radius: 5px 0 0 5px; background: var(--accent); }
.ev:hover { border-color: #ccc8bf; }
.ev.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.ev .t { font-weight: 500; font-size: 12.5px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.ev .s { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.ev .ok { color: var(--green); display: inline-block; margin-right: 3px; vertical-align: -1px; }
.ev .ok svg { width: 12px; height: 12px; display: block; }
.ev.done::before { background: var(--green); }
.ev.done .t { color: var(--muted); }
.ev.tentative { border-style: dashed; }
.ev.tentative::before { background: var(--faint); }
.ev.cancelled { opacity: .45; } .ev.cancelled .t { text-decoration: line-through; }
.ev.dragging { opacity: .4; }

/* ---------- danh sách ---------- */
.agenda { max-width: 900px; margin: 0 auto; padding: 18px 24px 48px; }
.agenda .day { margin-bottom: 10px; }
.agenda .dh { display: flex; align-items: baseline; gap: 8px; padding: 12px 2px 7px; font-weight: 700; font-size: 15px; position: sticky; top: 51px; background: var(--bg); z-index: 1; cursor: pointer; letter-spacing: -.1px; }
.agenda .dh .w { color: var(--muted); font-weight: 400; font-size: 13.5px; }
.agenda .dh.today { color: var(--accent); }
.agenda .dh .add { margin-left: auto; width: 26px; height: 26px; opacity: .6; }
.agenda .dh .add:hover { opacity: 1; }
.agenda .empty { padding: 10px 14px; margin: 2px 0; color: var(--faint); font-size: 13px; border: 1px dashed var(--line); border-radius: var(--radius); cursor: pointer; }
.agenda .dnote { font-size: 12.5px; color: var(--muted); padding: 5px 10px; border-left: 2px solid #d9c98a; background: #fbf8ec; border-radius: 2px; margin: 0 0 6px; }
.row { display: flex; align-items: flex-start; gap: 14px; min-height: 54px; padding: 12px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 6px; cursor: pointer; transition: border-color .12s; }
.row:hover { border-color: #cfcbc2; }
.row.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.row .main-t { flex: 1; min-width: 0; }
.row .main-t b { font-weight: 500; font-size: 14.5px; word-break: break-word; line-height: 1.4; }
.row .main-t span { display: block; font-size: 13px; color: var(--muted); margin-top: 2px; word-break: break-word; }
.row .main-t .flags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.row .tk { margin-top: 1px; }
.row.past { opacity: .62; }
.row.done .main-t b { text-decoration: line-through; text-decoration-color: #b7b3aa; color: var(--muted); }
.more-past { margin: 10px auto 0; display: flex; }

/* ---------- cột phải ---------- */
.panel { border-left: 1px solid var(--line); background: var(--surface); min-height: 0; overflow-y: auto; display: flex; flex-direction: column; }
.app.nopanel .panel { display: none; }
.ph { padding: 20px 22px 16px; border-bottom: 1px solid var(--line2); position: sticky; top: 0; background: var(--surface); z-index: 3; }
.ph .back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 13px; border: 0; background: none; padding: 0; margin-bottom: 10px; }
.ph .back:hover { color: var(--text); }
.ph .back svg { width: 14px; height: 14px; }
.ph .over { font-size: 12.5px; font-weight: 500; color: var(--faint); padding-right: 30px; }
.ph h2 { margin: 4px 0 0; font-size: 21px; font-weight: 700; letter-spacing: -.4px; line-height: 1.3; padding-right: 28px; word-break: break-word; }
.ph h2 .okt { font-size: 13px; letter-spacing: 0; }
.ph .sub { color: var(--muted); margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; align-items: center; }
.ph .sub b { color: var(--text); }
.ph .acts { display: flex; gap: 6px; margin-top: 14px; flex-wrap: wrap; }
.ph .x { position: absolute; right: 12px; top: 14px; }
.ph .x svg { width: 18px; height: 18px; }
.pb { padding: 16px 18px 36px; display: flex; flex-direction: column; gap: 12px; }
.prog { margin-top: 14px; display: flex; align-items: center; gap: 12px; font-size: 12.5px; color: var(--muted); }
.prog .pbar { flex: 1; height: 5px; background: var(--line2); border-radius: 3px; overflow: hidden; }
.prog .pbar i { display: block; height: 100%; background: var(--text); border-radius: 3px; transition: width .3s; }
.prog.full .pbar i { background: var(--green); }
.prog .okt { margin-left: 0; }
.tabs { display: flex; gap: 18px; margin-top: 16px; border-bottom: 0; margin-bottom: -17px; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 8px 0 11px; font-weight: 500; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button:hover { color: var(--text); }
.tabs button.on { color: var(--text); border-bottom-color: var(--text); }
.donebar { display: flex; align-items: center; gap: 10px; padding: 11px 14px; background: var(--green-bg); color: var(--green); border-radius: var(--radius); font-weight: 500; }
.donebar svg { width: 18px; height: 18px; flex: none; }

.box { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.box > .bh { display: flex; align-items: center; gap: 10px; padding: 12px 14px; cursor: pointer; user-select: none; }
.box > .bh .bt { font-weight: 500; font-size: 14.5px; }
.box > .bh .role { font-size: 11.5px; font-weight: 500; color: var(--faint); order: 3; margin-left: auto; }
.box > .bh .cnt { order: 4; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.box > .bh .role + .bt + .cnt { margin-left: 0; }
.box > .bh .chev { order: 5; color: var(--faint); transition: transform .15s; }
.box > .bh .chev svg { width: 16px; height: 16px; display: block; }
.box.closed > .bh .chev { transform: rotate(-90deg); }
.box.closed > .bb { display: none; }
.box > .bb { padding: 0 14px 14px; display: grid; gap: 10px; }
.sub-h { font-size: 12px; font-weight: 500; color: var(--faint); margin: 4px 0 -4px; display: flex; align-items: center; }
.sub-h .grow { flex: 1; }
.hint { font-size: 12.5px; color: var(--faint); line-height: 1.5; }

/* dòng tích trong cột phải */
.checks { display: grid; gap: 1px; }
.ck { display: flex; align-items: flex-start; gap: 11px; padding: 7px 6px; border-radius: 6px; min-height: 36px; }
.ck:hover { background: var(--soft); }
.checks.big .ck { padding: 10px 8px; border-bottom: 1px solid var(--line2); border-radius: 0; }
.checks.big .ck:last-child { border-bottom: 0; }
.ck .box-i { width: 20px; height: 20px; margin-top: 0; border-radius: 50%; border: 1.6px solid #bdb9b0; flex: none; display: grid; place-items: center; cursor: pointer; background: #fff; transition: background .12s, border-color .12s; }
.ck .box-i:hover { border-color: var(--green); }
.ck.on .box-i { background: var(--green); border-color: var(--green); }
.ck.on .box-i::after { content: ""; width: 8px; height: 4px; border: 2px solid #fff; border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
.ck .txt { flex: 1; min-width: 0; padding-top: 1px; line-height: 1.45; word-break: break-word; }
.ck.on .txt > div:first-child, .ck.on .txt { color: var(--muted); }
.ck.on > .txt { text-decoration: line-through; text-decoration-color: #c4c0b7; }
.ck .who { font-size: 12.5px; color: var(--muted); }
.ck .del { opacity: 0; width: 24px; height: 24px; font-size: 15px; }
.ck:hover .del { opacity: 1; }
.ck.skip { opacity: .5; } .ck.skip .box-i { border-style: dashed; }
.ck .doc-f { display: flex; gap: 6px; margin-top: 6px; }
.ck .doc-f input { height: 30px; font-size: 13px; padding: 0 8px; }
.ck .doc-f input[type=date] { width: 140px; }
.ck .doc-f input.n { flex: 1; }
.ck .lnk { font-size: 12px; color: var(--faint); border: 0; background: none; padding: 2px 0; }
.ck .lnk:hover { color: var(--text); }
.ck .del svg, .ln .del svg, .file .del svg { width: 14px; height: 14px; }
.addline { display: flex; gap: 6px; flex-wrap: wrap; }
.addline input { flex: 1 1 180px; height: 34px; font-size: 13.5px; }
.addline input[type=date] { flex: 0 0 140px; }
.addline .btn { height: 34px; }

.kv { display: grid; grid-template-columns: 1fr auto; gap: 7px 12px; font-size: 13.5px; }
.kv .k { color: var(--muted); }
.kv .v { text-align: right; font-weight: 500; font-variant-numeric: tabular-nums; }
.kv .sep { grid-column: 1 / -1; border-top: 1px solid var(--line2); margin: 3px 0; }
.kv .big { font-size: 17px; font-weight: 700; }
.lines { display: grid; gap: 1px; }
.ln { display: flex; align-items: center; gap: 10px; padding: 7px 6px; border-radius: 6px; font-size: 13.5px; }
.ln:hover { background: var(--soft); }
.ln .grow { min-width: 0; }
.ln .grow b { font-weight: 500; }
.ln .v { font-weight: 500; font-variant-numeric: tabular-nums; }
.ln .del { opacity: 0; width: 24px; height: 24px; font-size: 15px; }
.ln:hover .del { opacity: 1; }
.ln .person { font-weight: 500; color: var(--text); border-bottom: 1px dashed #b7b3aa; }
.ln .person:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }
.minibtns { display: flex; gap: 6px; flex-wrap: wrap; }
.files { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.files:empty { display: none; }
.file { border: 1px solid var(--line); border-radius: 6px; overflow: hidden; position: relative; aspect-ratio: 1; display: grid; place-items: center; background: var(--soft); cursor: zoom-in; font-size: 11.5px; color: var(--muted); text-align: center; padding: 6px; word-break: break-all; }
.file img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.file .del { position: absolute; top: 4px; right: 4px; background: rgba(255,255,255,.94); opacity: 0; width: 24px; height: 24px; }
.file:hover .del { opacity: 1; }
.drop-z { border: 1px dashed #cfcbc2; border-radius: var(--radius); padding: 14px; text-align: center; color: var(--muted); font-size: 13px; cursor: pointer; background: var(--soft); }
.drop-z:hover, .drop-z.on { border-color: var(--text); color: var(--text); }
.tel { display: inline-flex; align-items: center; gap: 5px; font-weight: 500; }
.tel svg { width: 13px; height: 13px; }

/* thẻ job trong cột ngày */
.jcard { border: 1px solid var(--line); border-radius: var(--radius); padding: 13px 14px 13px 16px; position: relative; cursor: pointer; background: var(--surface); }
.jcard::before { content: ""; position: absolute; left: -1px; top: -1px; bottom: -1px; width: 3px; border-radius: var(--radius) 0 0 var(--radius); background: var(--accent); }
.jcard.done::before { background: var(--green); }
.jcard:hover { border-color: #cfcbc2; }
.jcard .t { font-weight: 500; font-size: 15px; }
.jcard .s { color: var(--muted); font-size: 13px; margin-top: 3px; }
.jcard .meta { display: flex; align-items: center; gap: 6px; margin-top: 9px; flex-wrap: wrap; }
.daynote textarea { width: 100%; min-height: 70px; background: #fcfaf1; border-color: #ebe2bf; }
.empty-s { text-align: center; color: var(--muted); padding: 32px 12px; line-height: 1.5; }
.empty-s b { display: block; color: var(--text); margin-bottom: 4px; font-size: 15px; font-weight: 500; }
.arow { display: flex; align-items: center; gap: 12px; padding: 10px 10px; border-radius: 7px; cursor: pointer; }
.arow:hover { background: var(--soft); }
.arow.nohand { cursor: default; }
.arow .grow { min-width: 0; }
.arow .grow b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.arow .grow span { font-size: 12.5px; color: var(--muted); }

/* chi tiết dòng ở cột phải */
.ititle { display: flex; align-items: flex-start; gap: 12px; margin-top: 6px; padding-right: 26px; }
.ititle .tk { margin-top: 7px; }
.ititle .tt { flex: 1; border: 0; font-size: 20px; font-weight: 700; letter-spacing: -.3px; padding: 2px 4px; resize: none; overflow: hidden; line-height: 1.35; height: auto; min-height: 34px; }
.ititle .tt:focus { box-shadow: 0 0 0 2px var(--accent-bg); }
.iform { display: grid; gap: 12px; }

/* ---------- trang ---------- */
.page { padding: 24px 28px 48px; max-width: 1240px; margin: 0 auto; }
.page.narrow { max-width: 920px; }
.page h2 { font-size: 17px; font-weight: 700; letter-spacing: -.2px; margin: 26px 0 12px; display: flex; align-items: center; gap: 8px; }
.page h2:first-child { margin-top: 0; }
.sech { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 30px 0 12px; }
.sech h2 { margin: 0 !important; }
.sech .muted { font-size: 13px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.kpi .l { font-size: 13px; color: var(--muted); }
.kpi .v { font-size: 24px; font-weight: 700; margin-top: 6px; font-variant-numeric: tabular-nums; letter-spacing: -.5px; }
.kpi .h { font-size: 12px; color: var(--faint); margin-top: 3px; font-variant-numeric: tabular-nums; }
.cards2 { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; }
.card > .ch2 { display: flex; align-items: center; gap: 8px; padding: 10px 12px 8px; font-weight: 500; font-size: 15px; }
.card.pad { padding: 10px 12px 14px; margin-bottom: 16px; }
.toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.pnote { color: var(--muted); font-size: 13px; margin-bottom: 14px; line-height: 1.55; }
.lsum { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 16px 0 10px; font-size: 13px; }
table.tb { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; table-layout: fixed; }
.tb th { text-align: left; font-size: 12px; font-weight: 500; color: var(--muted); padding: 11px 12px; border-bottom: 1px solid var(--line); background: var(--soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb td { padding: 10px 12px; border-bottom: 1px solid var(--line2); vertical-align: middle; overflow: hidden; text-overflow: ellipsis; }
.tb tr:last-child td { border-bottom: 0; }
.tb tbody tr:hover td { background: var(--soft); }
.tb .r { text-align: right; font-variant-numeric: tabular-nums; }
.tb .c { text-align: center; }
.tb td b { font-weight: 500; }
.tb .two { display: block; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tbwrap { overflow-x: auto; border-radius: var(--radius); }
.ctvtb { min-width: 720px; }
.chart { display: flex; align-items: flex-end; gap: 14px; height: 190px; padding: 12px 16px 0; }
.chart .c { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.chart .bars { display: flex; gap: 3px; align-items: flex-end; height: 100%; width: 100%; justify-content: center; }
.chart .bars i { width: 30%; max-width: 20px; border-radius: 3px 3px 0 0; background: var(--text); min-height: 2px; }
.chart .bars i.b { background: #a9a59c; } .chart .bars i.g { background: var(--green); }
.chart .lb { font-size: 12px; color: var(--muted); }
.legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--muted); padding: 10px 16px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }

/* ô tích tròn kiểu To Do */
.tk { width: 21px; height: 21px; border-radius: 50%; border: 1.6px solid #b9b5ac; flex: none; display: grid; place-items: center; cursor: pointer; background: #fff; transition: background .12s, border-color .12s; }
.tk:hover { border-color: var(--green); }
.tk:hover::after, .tk.on::after { content: ""; width: 8px; height: 4px; border: 2px solid currentColor; border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); color: var(--green); }
.tk.on { background: var(--green); border-color: var(--green); }
.tk.on::after { color: #fff; }
.tk.ro { cursor: inherit; border-style: solid; }
.tk.ro:not(.on):hover { border-color: #b9b5ac; }
.tk.ro:not(.on):hover::after { content: none; }

/* nhóm Đã hoàn thành */
.dgrp { margin-top: 18px; }
.dgh { display: inline-flex; align-items: center; gap: 7px; border: 0; background: transparent; border-radius: 6px; height: 32px; padding: 0 8px 0 4px; font-weight: 500; color: var(--muted); }
.dgh:hover { background: var(--hover); color: var(--text); }
.dgh svg { width: 16px; height: 16px; transform: rotate(-90deg); transition: transform .15s; }
.dgrp.open .dgh svg { transform: none; }
.dgb { display: none; margin-top: 8px; }
.dgrp.open .dgb { display: grid; gap: 6px; }

/* dòng việc */
.addline.big { margin-bottom: 4px; }
.addline.big input { height: 42px; font-size: 14px; padding: 0 14px; }
.addline.big input[type=date] { flex: 0 0 160px; }
.addline.big .btn { height: 42px; padding: 0 18px; }
.tlist { display: grid; gap: 6px; }
.trow { display: flex; align-items: flex-start; gap: 14px; padding: 13px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; position: relative; transition: border-color .12s; }
.trow:hover { border-color: #cfcbc2; }
.trow.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.trow.lv-red { box-shadow: inset 3px 0 0 var(--red); }
.trow.lv-amber { box-shadow: inset 3px 0 0 var(--amber); }
.trow.on.lv-red, .trow.on.lv-amber { box-shadow: 0 0 0 1px var(--accent); }
.trow .tk { margin-top: 1px; }
.trow .tmain { flex: 1; min-width: 0; }
.trow .tmain b { font-weight: 500; font-size: 14.5px; line-height: 1.4; word-break: break-word; }
.trow .tsub { display: block; font-size: 13px; color: var(--muted); margin-top: 2px; word-break: break-word; }
.trow .tsub a { color: var(--muted); }
.trow .ttags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.trow .tside { display: flex; align-items: center; gap: 10px; flex: none; }
.trow .amt { text-align: right; line-height: 1.35; }
.trow .amt b { display: block; font-variant-numeric: tabular-nums; font-weight: 700; font-size: 14.5px; }
.trow .amt span, .trow .amt a { font-size: 12px; color: var(--muted); display: block; }
.trow .frac { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.trow .tgo { color: #c4c0b7; align-self: center; }
.trow .tgo svg { width: 16px; height: 16px; display: block; }
.trow:hover .tgo { color: var(--text); }
.trow.done { background: var(--soft); }
.trow.done .tmain > b { text-decoration: line-through; text-decoration-color: #c4c0b7; color: var(--muted); }
.trow.done .tag.soft { opacity: .7; }

/* ---------- cửa sổ, thông báo, thanh lệnh ---------- */
.ov { position: fixed; inset: 0; background: rgba(29, 28, 26, .32); display: grid; place-items: start center; padding: 7vh 16px; z-index: 50; overflow-y: auto; animation: fin .14s ease-out; }
@keyframes fin { from { opacity: 0; } }
.ov { grid-template-columns: minmax(0, 1fr); }
.dlg { justify-self: center; width: 560px; max-width: 100%; background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-lg); animation: din .18s ease-out; }
@keyframes din { from { transform: translateY(6px); opacity: 0; } }
.dlg.sm { width: 420px; }
.dlg.wide { width: 640px; }
.dlg .dh { display: flex; align-items: center; padding: 20px 22px 6px; font-weight: 700; font-size: 18px; letter-spacing: -.3px; }
.dlg .dh .grow { flex: 1; }
.dlg .db { padding: 12px 22px; display: grid; gap: 14px; }
.dlg .df { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px 20px; }
.dlg .df .left { margin-right: auto; }
.fg { display: grid; gap: 6px; }
.fg > span { font-size: 13px; font-weight: 500; color: #4a4741; }
.fr { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.fr3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.chkline { display: flex; align-items: center; gap: 9px; font-size: 13.5px; cursor: pointer; }
.chkline.strong { font-weight: 500; flex-wrap: wrap; } .chkline.strong .faint { font-weight: 400; font-size: 12.5px; }
.fsec { font-size: 12px; font-weight: 500; color: var(--muted); border-top: 1px solid var(--line2); padding-top: 16px; margin-top: 4px; }
.colors { display: flex; gap: 8px; }
.colors label { width: 26px; height: 26px; border-radius: 50%; cursor: pointer; border: 3px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.colors input { display: none; }
.colors label:has(input:checked) { box-shadow: 0 0 0 2px var(--text); }

/* form job: sản phẩm bàn giao, CTV + chi phí theo dòng */
.dv { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip-ck { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px 0 11px; border: 1px solid var(--line); border-radius: 7px; cursor: pointer; font-weight: 500; font-size: 13.5px; background: var(--surface); user-select: none; }
.chip-ck:hover { border-color: #cfcbc2; }
.chip-ck input { display: none; }
.chip-ck i { width: 16px; height: 16px; border-radius: 4px; border: 1.5px solid #b9b5ac; display: grid; place-items: center; flex: none; }
.chip-ck:has(input:checked) { border-color: var(--text); box-shadow: inset 0 0 0 1px var(--text); }
.chip-ck:has(input:checked) i { background: var(--text); border-color: var(--text); }
.chip-ck:has(input:checked) i::after { content: ""; width: 7px; height: 3.5px; border: 1.8px solid #fff; border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
.dv-other { flex: 1 1 180px; height: 36px; }
#dvBox.err .chip-ck { border-color: #e6b3ac; }
#dvBox.err > span { color: var(--red); }
#dvBox .hint { margin-top: 0; }
.crows { display: grid; gap: 6px; }
.crow { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) 32px; gap: 6px; align-items: center; }
.crow:has(.c-name:not([hidden])) { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, .9fr) 32px; }
.crow.cost { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) 32px; }
.crow .okt { margin-left: 0; font-size: 11.5px; }
.addrow { justify-self: start; margin-top: 2px; color: var(--muted); border-style: dashed; }
.addrow svg { width: 14px; height: 14px; }
.qprev { background: var(--soft); border: 1px solid var(--line2); border-radius: 7px; padding: 9px 12px; font-size: 13px; color: var(--muted); }
.qprev b { color: var(--text); }

/* popup hoàn thành */
.celebrate { text-align: center; padding-top: 26px; }
.cel-ic { width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 50%; background: var(--green); color: #fff; display: grid; place-items: center; animation: pop .45s cubic-bezier(.2, 1.6, .4, 1); }
.cel-ic svg { width: 32px; height: 32px; }
.cel-t { font-size: 20px; font-weight: 700; letter-spacing: -.3px; padding: 0 20px; }
.cel-s { color: var(--muted); margin-top: 6px; padding: 0 24px; }
@keyframes pop { 0% { transform: scale(.4); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

.ctx { position: fixed; z-index: 60; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; box-shadow: var(--shadow-lg); padding: 5px; min-width: 190px; }
.ctx button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 11px; border-radius: 6px; font-weight: 400; }
.ctx button:hover { background: var(--hover); }
.ctx button.danger { color: var(--red); }
.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); display: grid; gap: 8px; z-index: 70; }
.toast { display: flex; align-items: center; gap: 14px; background: var(--text); color: #fff; padding: 11px 16px; border-radius: 8px; box-shadow: var(--shadow-lg); font-weight: 500; font-size: 13.5px; animation: tin .18s ease-out; }
.toast.err { background: var(--red); }
.toast button { background: none; border: 0; color: #f3d38a; font-weight: 500; padding: 0; }
@keyframes tin { from { transform: translateY(8px); opacity: 0; } }
.cmd { width: 620px; }
.cmd input { width: 100%; height: 52px; border: 0; border-bottom: 1px solid var(--line); border-radius: 12px 12px 0 0; font-size: 16px; padding: 0 20px; box-shadow: none !important; }
.cmd .res { max-height: 56vh; overflow-y: auto; padding: 6px; }
.cmd .it { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 7px; cursor: pointer; }
.cmd .it.on { background: var(--hover); }
.cmd .it .grow { min-width: 0; }
.cmd .it .grow span { color: var(--muted); font-size: 12.5px; margin-left: 6px; }
.cmd .gh { font-size: 12px; font-weight: 500; color: var(--faint); padding: 8px 12px 4px; }
.scrim { display: none; }

/* CTV: ảnh CCCD */
.idph { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.idslot { position: relative; aspect-ratio: 1.58; border: 1px dashed #cfcbc2; border-radius: var(--radius); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--muted); cursor: pointer; overflow: hidden; background: var(--soft); font-weight: 500; font-size: 13px; }
.idslot svg { width: 22px; height: 22px; }
.idslot small { color: var(--faint); font-weight: 400; }
.idslot:hover { border-color: var(--text); color: var(--text); }
.idslot.has { border-style: solid; border-color: var(--line); }
.idslot.has a { position: absolute; inset: 0; display: grid; place-items: center; }
.idslot.has img { width: 100%; height: 100%; object-fit: cover; }
.idslot.has > span { position: absolute; left: 6px; bottom: 6px; background: rgba(29,28,26,.62); color: #fff; padding: 2px 8px; border-radius: 4px; font-size: 11.5px; }
.idslot .del { position: absolute; top: 4px; right: 4px; background: rgba(255,255,255,.94); }
.fgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.fgrid .full { grid-column: 1 / -1; }
.hist { max-height: 220px; overflow-y: auto; border: 1px solid var(--line); border-radius: 7px; padding: 4px; }

/* cài đặt */
.setf { display: grid; gap: 10px; padding: 4px 12px; }
.setf label { display: flex; align-items: center; gap: 12px; justify-content: space-between; }
.setf label span { color: var(--text); }
.setf input { width: 90px; text-align: right; flex: none; }

/* ---------- màn hình nhỏ ---------- */
@media (max-width: 1600px) { :root { --panel-w: 440px; } .top kbd, #searchBtn .hide-s { display: none; } #searchBtn { padding: 0 10px; } }
@media (max-width: 1500px) { .quick { display: none; } }
@media (max-width: 1280px) { :root { --panel-w: 400px; } .calctl .range { font-size: 14px; } }
@media (max-width: 1100px) {
  .app, .app.nopanel { grid-template-columns: var(--side-w) minmax(0, 1fr); }
  .panel { position: fixed; right: 0; top: 0; bottom: 0; width: min(460px, 100vw); z-index: 40; box-shadow: var(--shadow-lg); transform: translateX(105%); transition: transform .2s; }
  .app.panel-open .panel { transform: none; }
  .app.panel-open .scrim { display: block; position: fixed; inset: 0; background: rgba(29,28,26,.25); z-index: 35; }
  .quick { display: none; }
  .cards2 { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  :root { font-size: 14.5px; }
  .app, .app.nopanel { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 280px; z-index: 45; transform: translateX(-105%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  .app.side-open .side { transform: none; }
  .app.side-open .scrim { display: block; position: fixed; inset: 0; background: rgba(29,28,26,.25); z-index: 42; }
  .only-m { display: inline-grid; }
  .top { padding: 8px 10px; gap: 4px; height: auto; flex-wrap: wrap; row-gap: 8px; }
  #modes { order: 9; width: 100%; } #modes button { flex: 1; }
  .panel { width: 100vw; }
  .top h1, .hide-s, .top kbd { display: none; }
  .top h1#pageTitle:not(.hide) { display: block; font-size: 16px; flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .calctl .range { font-size: 13.5px; margin-left: 2px; }
  .seg button { padding: 0 8px; }
  .month .wk { min-height: 78px; }
  .month .dow div { padding: 7px 4px; text-align: center; }
  .ev .s { display: none; }
  .ev { padding: 2px 4px 2px 6px; } .ev .t { font-size: 11px; -webkit-line-clamp: 1; }
  .cell { padding: 3px 2px 5px; }
  .cell.has:not(.past) { box-shadow: inset 0 2px 0 var(--accent); }
  .page { padding: 16px 12px 48px; }
  .fr3, .fgrid { grid-template-columns: 1fr; }
  #newJob { padding: 0 12px; }
  .daynote, .cell .dnote { display: none; }
  .pnote { display: none; }
  .trow { flex-wrap: wrap; padding: 12px; }
  .trow .tside { width: 100%; padding-left: 35px; justify-content: space-between; }
  .trow .tgo { display: none; }
  .agenda { padding: 10px 10px 48px; }
  .row { padding: 11px 12px; gap: 12px; }
  .addline.big { flex-wrap: wrap; } .addline.big input[name=t] { flex: 1 1 100%; }
  .kpis { grid-template-columns: 1fr 1fr; } .kpi .v { font-size: 19px; } .kpi { padding: 13px 14px; }
  .mbar { padding: 8px 10px; }
  .month .dow, .agenda .dh { top: 49px; }
  .ph { padding: 16px 16px 14px; }
  .pb { padding: 14px 12px 36px; }
  .dlg .db, .dlg .dh, .dlg .df { padding-left: 16px; padding-right: 16px; }
  .ov { padding: 12px 8px; }
  .chip-ck { padding: 0 11px 0 9px; }
  .crow, .crow.cost { grid-template-columns: minmax(0, 1fr) 110px 32px; }
  .crow:has(.c-name:not([hidden])) { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .crow:has(.c-name:not([hidden])) .c-fee { grid-column: 1; }
  .sech { margin-top: 24px; }
}
@media (max-width: 420px) { .fr { grid-template-columns: 1fr; } }

/* ===== GHI ĐÈ bản 4.2 — để CUỐI tệp để thắng các luật gốc phía trên ===== */
/* khung màu Lịch quay chụp (đỏ cam) / Lịch edit (xanh) — giống khung Công nợ */
.frame { border-radius: 12px; border: 1px solid; overflow: hidden; box-shadow: var(--card-shadow); margin-bottom: 18px; }
.frh { display: flex; align-items: center; gap: 13px; padding: 14px 18px; border-bottom: 1px solid; flex-wrap: wrap; }
.fri { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: #fff; flex: none; }
.fri svg { width: 19px; height: 19px; }
.frt { flex: 1 1 240px; min-width: 0; }
.frt h2 { margin: 0 !important; font-size: 16px; text-transform: uppercase; letter-spacing: .6px; font-weight: 700; }
.frt span { font-size: 12.5px; color: var(--muted); }
.frbtn { background: #fff; }
.frb { padding: 12px; }
.fr-shoot { border-color: #efbfa8; background: #fdf3ee; }
.fr-shoot .frh { background: #f9dccd; border-color: #f2c9b4; box-shadow: inset 5px 0 0 #c4521f; }
.fr-shoot .fri { background: #c4521f; } .fr-shoot h2 { color: #9c3b14; } .fr-shoot .frbtn { border-color: #eab79c; color: #a6411a; }
.fr-edit { border-color: #a9d3d6; background: #f0f8f8; }
.fr-edit .frh { background: #d5ecee; border-color: #bfe0e2; box-shadow: inset 5px 0 0 #1f7a80; }
.fr-edit .fri { background: #1f7a80; } .fr-edit h2 { color: #165b60; } .fr-edit .frt b { color: var(--red); }
.fr-edit .trow { border-left: 3px solid #4aa3a8; }
.fr-edit .addline { margin-bottom: 12px; }
.agenda .frame .day { box-shadow: none; }
.agenda .frame .day .row { border-left-color: #d9734a; background: #fffaf7; }
.agenda .frame .day .row.done { border-left-color: var(--green); background: #f3faf5; }
/* lưới tháng: tiêu đề thứ tông đỏ cam */
.month .dow { background: #f9dccd; border-color: #efbfa8; box-shadow: inset 0 3px 0 #c4521f; }
.month .dow div { color: #9c3b14; }
.month .dow div:nth-child(n+6) { color: #c4521f; }

.psadd { background: #fff; flex: none; }
.ps-contract .psadd { border-color: #efbcb6; color: #8f1c13; } .ps-invoice .psadd { border-color: #efcf9e; color: #8a4806; } .ps-other .psadd { border-color: #bccbe8; color: #22437f; }
.pnone { padding: 14px; text-align: center; color: var(--faint); font-size: 13px; }

/* cột phải để trống (chưa chọn dòng nào) */
.pempty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 40px 30px; text-align: center; color: var(--faint); font-size: 13px; }
.pempty svg { width: 22px; height: 22px; transform: rotate(180deg); opacity: .5; }
/* hàng đang chọn: đậm hẳn (mọi trang) */
.trow.on, .trow.on.lv-red, .trow.on.lv-amber { background: color-mix(in srgb, var(--ink) 9%, #fff); border-color: var(--ink); box-shadow: 0 0 0 2px var(--ink), 0 4px 14px rgba(40,28,18,.14); }
.trow.on .tmain > b { color: var(--ink); font-weight: 700; }
.trow.on .tgo { color: var(--ink); }
.trow .frac.big { font-size: 15px; font-weight: 700; color: var(--text); min-width: 38px; text-align: right; }

/* ---------- Lịch quay chụp làm lại (bản 4.2): khung rõ, chip job có nền, hôm nay nổi bật ---------- */
.mchip.on { background: var(--ink); border-color: var(--ink); }
.month { background: var(--bg); padding: 0 14px 16px; }
.month .dow { margin-top: 12px; background: var(--soft); border: 1px solid var(--line); border-radius: 12px 12px 0 0; top: 51px; }
.month .dow div { color: var(--muted); font-weight: 700; font-size: 11.5px; text-transform: uppercase; letter-spacing: .5px; padding: 10px 12px; }
.month .dow div:nth-child(n+6) { color: #b0451c; }
.month .wk { background: var(--surface); border: 1px solid var(--line); border-top: 0; min-height: 124px; }
.month .wk:last-child { border-radius: 0 0 12px 12px; overflow: hidden; box-shadow: var(--card-shadow); }
.cell { border-right-color: var(--line2); padding: 6px 7px 9px; gap: 5px; }
.cell.we:not(.past) { background: color-mix(in srgb, #e08a5f 5%, #fff); }
.cell.past { background: color-mix(in srgb, var(--bg) 45%, #fff); }
.cell.past .dn { color: var(--faint); }
.cell.has:not(.past) { background: #fff; }
.cell.today { background: color-mix(in srgb, var(--ink) 6%, #fff) !important; box-shadow: inset 0 0 0 2px var(--ink); z-index: 1; }
.cell.today .dn { background: var(--ink); }
.cell.sel:not(.today) { box-shadow: inset 0 0 0 2px var(--accent); }
.cell .dn { font-size: 13.5px; }
.ev { background: color-mix(in srgb, var(--accent) 9%, #fff); border-color: color-mix(in srgb, var(--accent) 28%, #fff); padding: 6px 8px 6px 12px; border-radius: 6px; box-shadow: 0 1px 2px rgba(20,16,12,.06); }
.ev::before { width: 4px; border-radius: 6px 0 0 6px; }
.ev:hover { border-color: color-mix(in srgb, var(--accent) 55%, #fff); background: color-mix(in srgb, var(--accent) 14%, #fff); }
.ev .t { font-weight: 600; color: var(--text); }
.ev .s { color: color-mix(in srgb, var(--text) 62%, #fff); }
.ev.done { background: #eef7f1; border-color: #cfe7d8; }
.ev.done .t { color: #4d7a5f; }
.ev.on { border-color: var(--ink); box-shadow: 0 0 0 2px var(--ink); background: color-mix(in srgb, var(--ink) 9%, #fff); }
/* danh sách: mỗi ngày một khối */
.agenda .day { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 0 12px 8px; margin-bottom: 14px; box-shadow: var(--card-shadow); }
.agenda .dh { background: var(--surface); margin: 0 -12px 10px; padding: 12px 16px 10px; border-bottom: 1px solid var(--line2); border-radius: 12px 12px 0 0; font-size: 16px; }
.agenda .day:has(.dh.today) { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink), var(--card-shadow); }
.agenda .dh.today { color: var(--ink); background: color-mix(in srgb, var(--ink) 7%, #fff); }
.agenda .day .row { border-left: 4px solid var(--accent); background: color-mix(in srgb, var(--accent) 4%, #fff); }
.agenda .day .row.done { border-left-color: var(--green); background: #f3faf5; }
.row.on { border-color: var(--ink) !important; box-shadow: 0 0 0 2px var(--ink); background: color-mix(in srgb, var(--ink) 9%, #fff) !important; }
.row.on .main-t b { color: var(--ink); font-weight: 700; }
.agenda .dgrp .row { border-left: 4px solid var(--line); }


/* ===== Lịch quay chụp kiểu Microsoft To Do (bản 4.4): nền cam đậm, dòng sát nhau, ngày to bên trái ===== */
.agenda.todo { max-width: none; margin: 0; padding: 22px 26px 40px; background: #c4532f; min-height: calc(100% - 51px); }
.tdh { display: flex; align-items: center; gap: 14px; margin: 0 0 16px; color: #fff; }
.tdh h1 { margin: 0; font-size: 26px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; }
.tdh span { font-size: 13.5px; opacity: .85; }
.tdbtn { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border: 0; border-radius: 6px; background: rgba(255,255,255,.92); color: #8a3214; font-weight: 600; }
.tdbtn:hover { background: #fff; }
.tdbtn svg { width: 15px; height: 15px; }
.tdlist { display: grid; gap: 4px; }
.tday { display: grid; gap: 2px; }
.agenda.todo .trw { display: flex; align-items: center; gap: 12px; min-height: 52px; margin: 0; padding: 6px 16px 6px 0; background: #fdf5f1; border: 0; border-radius: 5px; box-shadow: 0 1px 2px rgba(60,20,5,.18); border-left: 0 !important; }
.agenda.todo .trw:hover { background: #fff; }
.agenda.todo .trw .tk { margin: 0; }
.dblk { width: 66px; flex: none; align-self: stretch; display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center; align-content: center; column-gap: 1px; line-height: 1.05;
  border-right: 1px solid #f1d5c8; color: #8a3214; }
.dblk b { font-size: 21px; font-weight: 800; letter-spacing: -.5px; }
.dblk small { font-size: 12px; font-weight: 700; }
.dblk i { flex-basis: 100%; text-align: center; font-style: normal; font-size: 11px; font-weight: 600; color: #b9705a; margin-top: 2px; }
.dblk.tod { background: #8a3214; color: #fff; border-radius: 5px 0 0 5px; border-right: 0; }
.dblk.tod i { color: #ffd9c9; }
.dblk.cont { border-right: 1px dashed #f1d5c8; }
.agenda.todo .trw .main-t { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.agenda.todo .trw .main-t b { font-size: 14.5px; font-weight: 500; color: #2a1d16; }
.agenda.todo .trw .main-t span { display: inline; margin: 0; font-size: 12.5px; color: #8b766c; }
.trt { display: flex; gap: 5px; flex: none; }
.trt .tag { background: #fbe6dc; color: #8a3214; box-shadow: none; }
.agenda.todo .trw.on { background: #fff; box-shadow: 0 0 0 2px #3f2d21, 0 3px 10px rgba(40,15,5,.3); }
.agenda.todo .trw.on .main-t b { color: #3f2d21; font-weight: 700; }
.agenda.todo .trw.done .main-t b { text-decoration: line-through; color: #9c8a80; }
.agenda.todo .trw.past { opacity: 1; }
.agenda.todo .trw.past .main-t b { color: #6f5a50; }
.empty-r { cursor: pointer; }
.tdempty { color: #a48a7e; font-size: 13px; }
.tdnote { font-size: 12.5px; color: #6b4a3a; background: #fff4c9; border-left: 3px solid #e2b53e; padding: 5px 10px; border-radius: 4px; margin-left: 66px; }
.tdadd { display: flex; align-items: center; gap: 10px; width: 100%; height: 48px; margin-top: 8px; padding: 0 18px; border: 0; border-radius: 5px; background: rgba(255,255,255,.18); color: #fff; font-size: 14.5px; text-align: left; }
.tdadd:hover { background: rgba(255,255,255,.28); }
.tdadd svg { width: 18px; height: 18px; }
.agenda.todo .dgrp { margin-top: 18px; }
.agenda.todo .dgh { background: rgba(255,255,255,.9); color: #8a3214; border-radius: 5px; padding: 6px 12px; font-weight: 600; }
.agenda.todo .dgh .badge { background: #fbe6dc; color: #8a3214; }
.agenda.todo .dgrp.open .dgb { display: grid; gap: 2px; margin-top: 6px; }   /* chỉ hiện khi mở (lỗi 4.4: luôn hiện, không thu gọn được) */
.agenda.todo .dgb .trw { opacity: .55; }
.agenda.todo .more-past { background: rgba(255,255,255,.9); }
.agenda.todo .drop { outline: 2px dashed #fff; outline-offset: 2px; }
@media (max-width: 760px) {
  .agenda.todo { padding: 14px 10px 40px; }
  .tdh h1 { font-size: 20px; }
  .dblk { width: 52px; } .dblk b { font-size: 18px; }
  .trt { display: none; }
  .tdnote { margin-left: 52px; }
}
@media (max-width: 760px) { .tdh { gap: 8px; } .tdh h1 { white-space: nowrap; } .tdh > span:not(.grow) { display: none; } .agenda.todo .trw .main-t b { word-break: break-word; } }

/* ===== bản 4.5: logo, màu chuẩn, ngày/tháng đều, Lịch edit xanh ngọc, menu chữ to, khu HĐ xanh lá ===== */
.logo.img { background: none; border-radius: 22%; object-fit: cover; }
.side .brand .logo.img { width: 32px; height: 32px; }
.brand.big .logo.img { width: 46px; height: 46px; }
.agenda.todo { background: #C3504B; }
.agenda.todo .trw { background: #fdf4f3; }
.dblk { width: 76px; border-right-color: #f0d3d0; color: #8f2a24; }
.dblk b { font-size: 19px; font-weight: 800; letter-spacing: -.3px; }
.dblk small { font-size: 19px; font-weight: 800; letter-spacing: -.3px; }
.dblk i { color: #b8716b; }
.dblk.tod { background: #7d2420; }
.agenda.todo .dgh { color: #8f2a24; }
.agenda.todo .dgh .badge, .trt .tag { background: #f9e1de; color: #8f2a24; }
.agenda.todo .dgb .trw .main-t b { color: #9a8a87; }
/* Lịch edit: cùng kiểu, màu xanh ngọc */
.page.todo-wrap { max-width: none; margin: 0; padding: 0; min-height: 100%; }
.agenda.todo.t-edit { background: #2f7d86; min-height: 100%; }
.t-edit .trw { background: #f3fafa; }
.t-edit .dblk { border-right-color: #cfe5e7; color: #1d5d64; }
.t-edit .dblk i { color: #5f9a9f; }
.t-edit .dblk.tod { background: #1d5d64; color: #fff; } .t-edit .dblk.tod i { color: #cdeef0; }
.t-edit .dblk.late { background: #b42318; color: #fff; border-radius: 5px 0 0 5px; border-right: 0; } .t-edit .dblk.late i { color: #ffd6d1; }
.t-edit .trt .tag.soft { background: #dceef0; color: #1d5d64; }
.t-edit .trt .tag.ok { background: #e3f3e8; color: #17683b; }
.t-edit .frac { font-weight: 700; color: #1d5d64; min-width: 30px; text-align: right; }
.t-edit .dgh, .t-edit .tdbtn { color: #1d5d64; } .t-edit .dgh .badge { background: #dceef0; color: #1d5d64; }
.t-edit .trw.on { box-shadow: 0 0 0 2px #0f3d42, 0 3px 10px rgba(5,30,35,.3); }
.tdnone { padding: 16px; color: #fff; opacity: .85; }
.tdaddf { gap: 10px; }
.tdaddf input { flex: 1; min-width: 0; height: 34px; background: rgba(255,255,255,.95); border: 0; }
.tdaddf input[type=date] { flex: none; width: 150px; }
.tdaddf .tdbtn { flex: none; }
.agenda.todo .dblk.cont i { font-size: 11px; }
/* cột trái: chữ to hơn, giữ nguyên độ rộng cột */
.nav:not(.lists) a { font-size: 15px; letter-spacing: 0; min-height: 44px; }
.nav.lists a { font-size: 15.5px; }
.side .co { font-size: 15px; }
.side .sec-h { font-size: 12px; }
.side .brand { font-size: 18px; }
/* khu "Chưa có hợp đồng": xanh lá */
.ps-contract { border-color: #b7dcc4; background: #f1f9f4; } .ps-contract .psh { background: #d9f0e1; border-color: #c4e4cf; box-shadow: inset 5px 0 0 #1d7a45; }
.ps-contract .psi, .ps-contract .pcount { background: #1d7a45; } .ps-contract h2 { color: #145c33; } .ps-contract .trow { border-left: 3px solid #4fa874; }
.ps-contract .psadd { border-color: #9fd0b1; color: #145c33; }
@media (max-width: 760px) { .dblk { width: 60px; } .dblk b, .dblk small { font-size: 16px; } .tdaddf input[type=date] { width: 120px; } }.page.todo-wrap .agenda.todo { min-height: calc(100vh - 60px); }

/* ===== bản 4.6: cột trái hẹp hơn + chữ nhỏ lại; dòng 2 của job; chia sẻ mục ghi chú ===== */
:root { --side-w: 256px; }
.nav:not(.lists) a { font-size: 13.5px; min-height: 40px; padding: 7px 10px; }
.nav.lists a { font-size: 14px; min-height: 36px; }
.side .co { font-size: 14px; }
.side .sec-h { font-size: 11px; }
.side .brand { font-size: 17px; }
.nav a svg { width: 17px !important; height: 17px !important; }
.agenda.todo .trw .main-t { display: block; }
.agenda.todo .trw .main-t b { display: block; }
.agenda.todo .trw .main-t span { display: block; margin-top: 2px; font-size: 12.5px; color: #8b6f6a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lown { display: block; font-size: 11px; color: var(--side-faint); line-height: 1.2; }
.shbar { display: flex; align-items: center; gap: 8px; padding: 9px 12px; margin-bottom: 12px; border-radius: 8px; background: #eef4fb; border: 1px solid #cfdcef; color: #2e4a75; font-size: 13px; }
.shbar svg { width: 16px; height: 16px; flex: none; }
.shbar span { flex: 1; }
.shl { display: grid; border: 1px solid var(--line2); border-radius: 8px; max-height: 380px; overflow-y: auto; }
.shp { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--line2); cursor: pointer; }
.shp:last-child { border-bottom: 0; }
.shp:hover { background: var(--soft); }
.shp.own { cursor: default; background: var(--soft); }
.shp .grow { min-width: 0; }
.shp small { display: block; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shp input { width: 18px; height: 18px; }

/* ===== bản 4.7: bảng màu theo bánh xe màu (15 ô) ===== */
.themes.wheel { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 7px; margin: 0 0 14px 44px; }
.themes.wheel .thm { padding: 5px; gap: 4px; font-size: 11.5px; }
.themes.wheel .thm i { width: 100%; height: 30px; }
@media (max-width: 760px) { .themes.wheel { margin-left: 0; } }

/* ===== bản 4.8: bỏ ô tích, dòng "có file", điện thoại không cắt chữ ===== */
.agenda.todo .trw .main-t { flex: 1 1 auto; min-width: 0; padding-left: 2px; }
.agenda.todo .trw .main-t b { overflow-wrap: anywhere; }
.more-i { display: block; margin-top: 3px; font-style: normal; font-size: 12.5px; font-weight: 600; color: #1d7a45; }
.t-edit .more-i { color: #1d7a45; }
@media (max-width: 760px) {
  .agenda.todo .trw { align-items: flex-start; padding: 8px 10px 8px 0; gap: 10px; }
  .agenda.todo .trw .main-t span { white-space: normal; overflow: visible; overflow-wrap: anywhere; }
  .agenda.todo .dblk { align-self: stretch; }
  .agenda.todo, .tdlist, .tday { max-width: 100%; overflow-x: hidden; }
}
@media (max-width: 760px) {
  /* bảng (CTV, Nhân viên, nhật ký): vuốt ngang thay vì cắt chữ */
  .tbwrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tbwrap > .tb { min-width: 720px; }
  .tbwrap > .tb td, .tbwrap > .tb .two { white-space: normal; overflow: visible; text-overflow: clip; }
  /* biểu đồ 12 tháng: vuốt ngang */
  .rchart { overflow-x: auto; }
  .rchart .chart.c12, .rchart .legend { min-width: 560px; }
  /* tên dài ở cột phải / danh sách hành động: xuống dòng */
  #panel .grow b, .arow .grow b, .jcard b { white-space: normal; overflow-wrap: anywhere; }
}
@media (max-width: 760px) { .actlog { overflow-x: auto; } .actlog .tb { min-width: 560px; } .actlog .ell { white-space: normal; max-width: none; overflow: visible; } }
/* bản 4.9: ô ngày của job nhiều ngày "28+29/11" — chữ nhỏ dần cho vừa ô */
.dblk.multi b { font-size: 17px; letter-spacing: -.4px; }
.dblk.multi.sm b { font-size: 14.5px; }
.dblk.multi.xs b { font-size: 12px; letter-spacing: -.3px; }
.dblk.multi i { font-size: 10px; }
@media (max-width: 760px) { .dblk.multi b { font-size: 14px; } .dblk.multi.sm b { font-size: 12.5px; } .dblk.multi.xs b { font-size: 10.5px; } }
/* dòng dài không đẩy tràn khung (lưới cần minmax(0,1fr)) */
.tdlist, .tday { grid-template-columns: minmax(0, 1fr); min-width: 0; }
.agenda.todo .trw { min-width: 0; }
.trt { flex-shrink: 1; min-width: 0; flex-wrap: wrap; justify-content: flex-end; max-width: 30%; }
/* bản 4.11: ô lịch tháng ghi ngày/tháng; chữ "n job" không đè lên ngày ở ô hẹp */
.cell .ch { min-width: 0; }
.cell .dn { white-space: nowrap; flex: none; }
.cell .cnt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
@media (max-width: 1400px) { .cell .cnt { display: none; } }

/* 4.12 VAT: dòng tiền hợp đồng dưới giá trị job */
.vatprev{font-size:13px;color:var(--green,#1f7a4d);margin:-4px 0 8px}
.vatprev:empty{display:none}

/* 4.13 Công nợ: khoản của job chưa tới ngày → mờ */
.trow.later{opacity:.5}
.trow.later:hover,.trow.later.on{opacity:.85}

/* 4.14 Cột phải trống: nền nhạt + bàn tay gợi ý bấm (chuyển động chậm) */
.pempty { margin: 14px; border-radius: 16px; border: 1px dashed color-mix(in srgb, var(--ink, #6b4a2f) 28%, transparent);
  background: linear-gradient(180deg, color-mix(in srgb, var(--ink, #6b4a2f) 9%, transparent), color-mix(in srgb, var(--ink, #6b4a2f) 4%, transparent)); gap: 6px; }
.pempty b { color: var(--muted, #555); font-size: 14px; font-weight: 600; margin-top: 6px; }
.pempty .phint { position: relative; width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center;
  background: color-mix(in srgb, var(--ink, #6b4a2f) 14%, transparent); color: var(--ink, #6b4a2f); }
.pempty .phint .hand { width: 32px; height: 32px; opacity: .8; transform: none; transform-origin: 30% 10%; animation: ltdTap 2.6s ease-in-out infinite; }
.pempty .phint .ring { position: absolute; left: 30px; top: 18px; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; opacity: 0; animation: ltdRing 2.6s ease-out infinite; }
@keyframes ltdTap { 0%, 30%, 100% { transform: translate(0, 0) rotate(0); } 45% { transform: translate(-2px, 3px) rotate(-6deg) scale(.95); } 60% { transform: translate(0, 0) rotate(0); } }
@keyframes ltdRing { 0%, 42% { opacity: 0; transform: scale(.3); } 48% { opacity: .45; } 80%, 100% { opacity: 0; transform: scale(1.9); } }
@media (prefers-reduced-motion: reduce) { .pempty .phint .hand, .pempty .phint .ring { animation: none; } }
