:root {
  /* Giá trị mặc định = tông "Đêm"; themes.js ghi đè theo tông người dùng chọn (Cài đặt → Tông màu) */
  --bg: #0f1115; --panel: #171a21; --panel2: #1e222b; --line: #2a2f3a; --text: #e8eaee; --muted: #8b92a0;
  --accent: #22c55e; --accent-text: #22c55e; --on-accent: #06210f; --danger: #ef4444; --radius: 12px;
  --ok: #86efac; --bad: #f87171; --warn: #fbbf24; --gold: #facc15; --soft: rgba(255,255,255,.04);
  --paper: #fff4a3; --ink: #3b3313; --pattern: none;
  --line2: color-mix(in srgb, var(--text) 16%, var(--line));
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background-color: var(--bg); background-image: var(--pattern); color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif; font-size: 14px; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.app { display: grid; grid-template-columns: 230px 1fr; height: 100vh; }

/* Sidebar */
aside { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 16px 12px; gap: 14px; overflow: auto; }
.brand { font-weight: 700; font-size: 16px; padding: 0 6px; display: flex; gap: 8px; align-items: center; }
.brand b { width: 18px; height: 18px; background: var(--paper); border-radius: 3px 3px 7px 3px; display: inline-block; transform: rotate(-6deg); }
nav { display: flex; flex-direction: column; gap: 2px; }
nav button { text-align: left; background: none; border: 0; padding: 9px 10px; border-radius: 8px; color: var(--muted); }
nav button.on, nav button:hover { background: var(--panel2); color: var(--text); }
.side-h { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 0 6px; display: flex; justify-content: space-between; }
.filter { display: flex; flex-direction: column; gap: 2px; }
.filter label { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.filter label:hover { background: var(--panel2); }
.filter input { display: none; }
.filter .sw { width: 12px; height: 12px; border-radius: 4px; flex: none; border: 2px solid; }
.filter input:not(:checked) ~ .nm { color: var(--muted); text-decoration: line-through; }
.filter .pct { margin-left: auto; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.side-foot { margin-top: auto; font-size: 12px; color: var(--muted); padding: 0 6px; line-height: 1.5; }
kbd { background: var(--panel2); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; font-size: 11px; }

main { overflow: auto; padding: 20px 24px; }
.view { display: none; } .view.on { display: block; }
.topbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.topbar h1 { font-size: 22px; margin: 0 auto 0 0; font-weight: 650; }
.btn { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 7px 12px; }
.btn:hover { border-color: var(--line2); }
.btn.pri { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn.ghost { background: none; border-color: transparent; color: var(--muted); }
.btn.del { color: var(--danger); }
input[type=text], input[type=email], input[type=date], input[type=time], input[type=number], select {
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; outline: none; min-width: 0; }
input:focus, select:focus { border-color: var(--accent); }
input[type=color] { width: 32px; height: 32px; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: none; cursor: pointer; }
input[type=checkbox] { accent-color: var(--accent); width: 16px; height: 16px; }

/* Calendar */
.cal-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 18px; align-items: start; }
.cal { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.dow, .grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.dow div { padding: 8px; font-size: 12px; color: var(--muted); text-align: center; border-bottom: 1px solid var(--line); }
.cell { min-width: 0; min-height: 104px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 5px; cursor: pointer; position: relative; display: flex; flex-direction: column; gap: 2px; }
.cell:nth-child(7n) { border-right: 0; }
.cell.out { opacity: .38; }
.cell:hover { background: var(--panel2); }
.cell.sel { background: color-mix(in srgb, var(--accent) 13%, var(--panel)); box-shadow: inset 0 0 0 2px var(--accent); }
.cell .n { font-size: 12px; font-weight: 600; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; }
.cell.today .n { background: var(--accent); color: var(--on-accent); }
.cell .lu { position: absolute; top: 9px; left: 32px; font-size: 10.5px; color: var(--muted); line-height: 1; }
.cell .lu.l1 { color: var(--bad); font-weight: 600; }
.cell .lu.l15 { color: var(--warn); font-weight: 600; }
.cell .spans { display: flex; gap: 2px; position: absolute; top: 9px; right: 6px; }
.cell .spans i { width: 6px; height: 6px; border-radius: 2px; }
.chip { font-size: 11.5px; border-radius: 4px; padding: 1px 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-left: 3px solid; background: var(--soft); }
.chip.ms { background: none; border-left: 0; padding-left: 0; font-weight: 600; }
.chip.done { text-decoration: line-through; opacity: .55; }
.more { font-size: 11px; color: var(--muted); }

.day-panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; position: sticky; top: 0; }
.day-panel h2 { margin: 0 0 2px; font-size: 18px; }
.day-panel .sub { color: var(--muted); font-size: 12px; margin-bottom: 12px; }
.agenda { list-style: none; padding: 0; margin: 0 0 14px; display: flex; flex-direction: column; gap: 6px; }
.agenda li { display: flex; gap: 8px; align-items: center; background: var(--panel2); border-radius: 8px; padding: 8px; border-left: 4px solid; }
.agenda .tm { font-variant-numeric: tabular-nums; font-weight: 600; width: 44px; }
.agenda .tx { flex: 1; min-width: 0; }
.agenda .tx small { display: block; color: var(--muted); font-size: 11px; }
.agenda li.done .tx > span { text-decoration: line-through; opacity: .55; }
.agenda .ic { background: none; border: 0; color: var(--muted); padding: 2px 4px; border-radius: 4px; }
.agenda .ic:hover { color: var(--text); background: var(--line); }
.agenda .ic.on { color: var(--gold); }
.form { display: grid; gap: 8px; border-top: 1px solid var(--line); padding-top: 14px; }
.form .row { display: flex; gap: 8px; align-items: center; }
.form .row > * { flex: 1; min-width: 0; }
.form > input, .form select { width: 100%; }
.form label.chk { display: flex; gap: 6px; align-items: center; flex: none; color: var(--muted); }
.empty { color: var(--muted); font-style: italic; padding: 6px 0 12px; }

/* Projects */
.projects { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(360px, 100%), 1fr)); gap: 16px; }
.pcard { min-width: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; border-top: 4px solid var(--c); display: flex; flex-direction: column; gap: 12px; }
.pcard .head { display: flex; gap: 8px; align-items: center; }
.pcard .head input.name { flex: 1; font-size: 16px; font-weight: 600; background: none; border-color: transparent; padding: 4px 6px; }
.pcard .head input.name:hover, .pcard .head input.name:focus { border-color: var(--line); }
.pcard .meta { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.pcard .meta input { width: 100%; min-width: 0; }
.pcard .meta label { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--muted); }
.prog { padding-bottom: 14px; }
.prog .lbl { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.prog .lbl b { color: var(--text); font-size: 20px; font-variant-numeric: tabular-nums; }
.track { height: 12px; background: var(--panel2); border-radius: 6px; position: relative; overflow: visible; }
.track .fill { height: 100%; border-radius: 6px; background: var(--c); transition: width .4s; }
.track .now { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--text); opacity: .7; border-radius: 1px; }
.track .now::after { content: attr(data-l); position: absolute; top: 22px; left: 50%; transform: translateX(-50%); font-size: 10px; color: var(--muted); white-space: nowrap; }
.status { font-size: 12px; padding: 2px 8px; border-radius: 99px; background: var(--panel2); }
.status.late { color: var(--bad); } .status.ok { color: var(--ok); } .status.warn { color: var(--warn); }
.countdown { display: flex; gap: 8px; flex-wrap: wrap; }
.cd { background: var(--panel2); border-radius: 8px; padding: 8px 10px; flex: 1; min-width: 100px; }
.cd .v { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.cd .k { font-size: 11px; color: var(--muted); }
.sublist h4 { margin: 0 0 6px; font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.sublist ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.sublist li { display: flex; gap: 8px; align-items: center; padding: 4px 4px; border-radius: 6px; }
.sublist li:hover { background: var(--panel2); }
.sublist li .x { margin-left: auto; opacity: 0; background: none; border: 0; color: var(--muted); }
.sublist li:hover .x { opacity: 1; }
.sublist li.done span { text-decoration: line-through; color: var(--muted); }
.sublist .add { display: flex; gap: 6px; margin-top: 6px; }
.sublist .add input { flex: 1; }
.ms-d { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* Chart */
.topic { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 18px; }
.topic h2 { margin: 0; font-size: 17px; }
.topic .tsum { color: var(--muted); font-size: 12px; margin: 2px 0 14px; }
.chart-row { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.chart-row h3 { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 0 0 8px; font-weight: 600; }
svg text { fill: var(--muted); font-family: inherit; }
svg .lab { fill: var(--text); }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-top: 6px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* Settings */
.settings { max-width: 560px; display: flex; flex-direction: column; gap: 14px; }
.setting { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.setting h3 { margin: 0; font-size: 14px; }
.setting p { margin: 0; color: var(--muted); font-size: 12.5px; }
.setting .row { display: flex; gap: 8px; align-items: center; }
.keycap { flex: 1; text-align: center; padding: 9px; border: 1px dashed var(--line); border-radius: 8px; font-family: ui-monospace, Consolas, monospace; }
.keycap.rec { border-color: var(--accent); color: var(--accent-text); }
.swatches { display: flex; gap: 8px; }
.swatches button { width: 30px; height: 30px; border-radius: 6px 6px 12px 6px; border: 2px solid transparent; }
.swatches button.on { border-color: var(--text); }
.set-sub { margin: 4px 0 0; font-size: 13px; font-weight: 600; }
/* Ô chọn tông màu: mỗi ô mang biến CSS của tông đó (đặt bằng JS), --sel lấy màu nhấn của tông đang dùng */
.themes { --sel: var(--accent); display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.theme-card { display: flex; flex-direction: column; gap: 6px; padding: 6px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); color: var(--text); text-align: left; }
.theme-card:hover { border-color: var(--line2); }
.theme-card.on { outline: 2px solid var(--sel); outline-offset: 2px; }
.tc-prev, .tc-side, .tc-note, .tc-acc { display: block; }
.tc-prev { position: relative; width: 100%; height: 58px; border-radius: 8px; overflow: hidden; background-color: var(--bg); background-image: var(--pattern); border: 1px solid var(--line); }
.tc-side { position: absolute; left: 0; top: 0; bottom: 0; width: 22px; background: var(--panel); border-right: 1px solid var(--line); }
.tc-note { position: absolute; left: 32px; top: 9px; width: 34px; height: 36px; background-color: var(--paper); background-image: var(--note-pattern); border-radius: 2px 2px 8px 2px; box-shadow: 0 3px 8px rgba(0,0,0,.22); transform: rotate(-4deg); }
.tc-acc { position: absolute; right: 7px; bottom: 7px; width: 18px; height: 8px; border-radius: 99px; background: var(--accent); }
.tc-name { font-size: 12px; font-weight: 600; padding: 0 2px; }
.motifs { display: flex; flex-wrap: wrap; gap: 8px; }
.motif { width: 46px; height: 46px; border-radius: 10px; border: 1px solid var(--line); background-color: var(--panel2); background-size: 34px 34px; padding: 0; }
.motif.txt { width: auto; padding: 0 12px; font-size: 12.5px; color: var(--text); }
.motif:hover { border-color: var(--line2); }
.motif.on { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Dialog + toast */
dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; width: 380px; }
dialog::backdrop { background: rgba(0,0,0,.5); }
dialog h3 { margin: 0 0 12px; }
dialog .form { border: 0; padding: 0; }
dialog .acts { display: flex; gap: 8px; justify-content: flex-end; margin-top: 10px; }
dialog .acts .del { margin-right: auto; }
.toast { position: fixed; right: 20px; bottom: 20px; background: var(--panel2); border: 1px solid var(--line); border-left: 4px solid var(--gold);
  padding: 12px 16px; border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.4); max-width: 340px; transform: translateY(calc(100% + 40px)); transition: transform .3s; }
.toast.on { transform: none; }

/* ===== v2 ===== */
body { font-family: "Segoe UI", system-ui, -apple-system, "Noto Sans", "Noto Sans CJK SC", sans-serif; }
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 12.5px; }
.grow { flex: 1; }
.nowrap { white-space: nowrap; }
.err { color: var(--bad); font-size: 12.5px; margin: 0; min-height: 1em; }
.badge { font-size: 10px; background: linear-gradient(135deg, #facc15, #f59e0b); color: #2a1d00; padding: 1px 6px; border-radius: 99px; font-weight: 700; }
.btn.small { padding: 5px 10px; font-size: 12.5px; width: 100%; }
.plan-box { display: flex; flex-direction: column; gap: 6px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; }
.plan-box:empty { display: none; }
.meter { height: 5px; background: var(--panel2); border-radius: 3px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--accent); }
.topbar .muted { margin-right: 4px; }
.form .hint { font-size: 12px; color: var(--ok); min-height: 0; margin-top: -4px; }
.form .hint:empty { display: none; }
.sg { background: color-mix(in srgb, var(--accent) 9%, var(--panel)); border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line)); border-radius: 10px; padding: 10px; margin-bottom: 12px; }
.sg h4 { margin: 0 0 6px; font-size: 12px; color: var(--ok); font-weight: 600; }
.sg-i { display: flex; align-items: center; gap: 6px; padding: 5px 0 5px 8px; border-left: 3px solid; margin: 4px 0; }
.sg-i span { flex: 1; min-width: 0; }
.sg-i b { font-weight: 500; display: block; }
.sg-i small { color: var(--muted); font-size: 11px; }
.countdown .cd { min-width: 80px; }
.cd .of { font-size: 13px; color: var(--muted); }
.sublist .due { font-style: normal; font-size: 11px; color: var(--muted); margin-left: auto; }
.sublist li .x + .x { margin-left: 0; }
.sublist li .due + .x { margin-left: 6px; }
input.num { width: 72px; flex: none; }
textarea { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 9px; color: var(--text); font: inherit; resize: vertical; outline: none; width: 100%; }
textarea:focus { border-color: var(--accent); }

/* Heatmap */
.heat-scroll { overflow-x: auto; padding-bottom: 4px; }
rect.h0 { fill: var(--panel2); } rect.h1 { fill: color-mix(in srgb, var(--accent) 30%, var(--panel2)); } rect.h2 { fill: color-mix(in srgb, var(--accent) 55%, var(--panel2)); } rect.h3 { fill: color-mix(in srgb, var(--accent) 80%, var(--panel2)); } rect.h4 { fill: var(--accent); }
.legend svg { vertical-align: -2px; }

/* Import */
.drop { border: 2px dashed var(--line); border-radius: var(--radius); padding: 34px; text-align: center; display: flex; flex-direction: column; gap: 6px; align-items: center; background: var(--panel); transition: .15s; }
.drop.over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--panel)); }
.drop .big { font-size: 40px; }
.row-c { margin-top: 8px; }
.imp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.prompt { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px; font-size: 12px; white-space: pre-wrap; max-height: 190px; overflow: auto; margin: 0; color: var(--text); }
.imp-head { display: grid; grid-template-columns: 2fr 1fr 1.6fr 1fr auto; gap: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.imp-head label { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--muted); }
.imp-bar { display: flex; align-items: center; gap: 10px; margin: 12px 0; }
.imp-bar #iSummary { margin-right: auto; }
.imp-table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.imp-table th { text-align: left; font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; padding: 9px 10px; border-bottom: 1px solid var(--line); }
.imp-table td { padding: 6px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: 13px; }
.imp-table td input[type=text] { width: 100%; background: none; border-color: transparent; }
.imp-table td input[type=text]:hover, .imp-table td input[type=text]:focus { border-color: var(--line); background: var(--bg); }
.imp-table td input[type=time] { padding: 4px 6px; }
.imp-table td small { display: block; color: var(--muted); font-size: 11px; padding-left: 10px; }
.imp-table tr.off td { opacity: .4; }
.imp-table tr.off td:first-child { opacity: 1; }

/* Pro dialog */
#proDlg { width: 420px; }
.pro-list { margin: 8px 0 14px; padding-left: 20px; line-height: 1.7; }
#proDlg .form { gap: 10px; }
.qr-pay { display: flex; gap: 14px; align-items: center; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.qr-box { width: 156px; height: 156px; flex: none; background: #fff; border-radius: 8px; padding: 6px; box-sizing: border-box; }
.qr-box svg { width: 100%; height: 100%; display: block; }
.qr-info { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.qr-amount { font-size: 20px; font-weight: 700; }
.qr-wait { font-size: 13px; display: flex; align-items: center; gap: 6px; }
.qr-wait.ok { color: var(--accent-text); font-weight: 600; }
.muted.small { font-size: 11.5px; }
.spin { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--accent); animation: spin 1s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.settings .setting .row .grow { flex: 1; }

.sg .ic { background: none; border: 0; color: var(--ok); padding: 4px 8px; border-radius: 6px; }
.sg .ic:hover { background: color-mix(in srgb, var(--accent) 22%, transparent); }
.agenda .tx small { white-space: normal; }

/* Nhóm (team.js) */
.tm-who { text-align: right; font-size: 12px; }
.tm-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.tm-main, .tm-side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.tm-login { max-width: 520px; }
.tm-add { display: flex; flex-direction: column; gap: 8px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.tm-add .row > * { flex: 1; min-width: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chipbtn { background: var(--panel2); border: 1px solid var(--line); color: var(--muted); border-radius: 99px; padding: 4px 11px; font: inherit; font-size: 12px; cursor: pointer; }
.chipbtn.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.tm-tasks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.tm-task { display: flex; gap: 8px; align-items: center; background: var(--panel2); border-radius: 8px; padding: 8px; border-left: 4px solid; }
.tm-task .tx { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tm-task .tx > span { overflow-wrap: anywhere; }
.tm-task small { color: var(--muted); font-size: 11.5px; }
.tm-task.done .tx > span { text-decoration: line-through; opacity: .55; }
.tm-task select { flex: none; width: auto; max-width: 130px; padding: 4px 6px; font-size: 12px; }
.tm-task .ic, .tm-mem .ic, .tm-pend .ic, .tm-proj .ic { background: none; border: 0; color: var(--muted); padding: 2px 6px; border-radius: 4px; cursor: pointer; }
.tm-task .ic:hover, .tm-mem .ic:hover, .tm-pend .ic:hover, .tm-proj .ic:hover { color: var(--danger); background: var(--panel); }
.tm-mem, .tm-proj { display: flex; flex-direction: column; gap: 4px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.tm-mem small { font-size: 11.5px; }
.badge.member { background: var(--panel2); color: var(--muted); }
.late { color: var(--bad); font-weight: 600; }
.tm-proj .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.setting h3 .muted { font-weight: 400; margin-left: 6px; }
@media (max-width: 1100px) { .tm-grid { grid-template-columns: minmax(0, 1fr); } }

/* Gói & thanh toán (billing.js) */
#appBanner:empty { display: none; }
.banner { display: flex; align-items: center; gap: 10px; background: color-mix(in srgb, var(--warn) 14%, var(--panel)); border: 1px solid color-mix(in srgb, var(--warn) 55%, var(--line)); color: var(--text); border-radius: 10px; padding: 9px 12px; margin-bottom: 14px; font-size: 13.5px; }
.banner span { flex: 1; }
.banner .btn.small { width: auto; flex: none; }
.banner .ic { background: none; border: 0; color: inherit; opacity: .7; cursor: pointer; padding: 2px 6px; }
.banner .ic:hover { opacity: 1; }
#proDlg { width: 560px; }
#proBody h3 { margin-bottom: 4px; }
.bl-note { color: var(--warn); font-size: 13px; margin: 6px 0 0; }
.bl-note a { color: var(--accent-text); }
.bl-trial { display: flex; gap: 14px; align-items: center; background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 18%, var(--panel)), color-mix(in srgb, #3b82f6 14%, var(--panel))); border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); border-radius: 12px; padding: 14px; margin: 14px 0 4px; }
.bl-trial > div { flex: 1; } .bl-trial .btn { flex: none; }
.bl-period { display: inline-flex; background: var(--panel2); border: 1px solid var(--line); border-radius: 99px; padding: 3px; margin: 14px 0 10px; }
.bl-period button { border: 0; background: none; color: var(--muted); font: inherit; font-size: 13px; padding: 6px 14px; border-radius: 99px; cursor: pointer; }
.bl-period button.on { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.bl-plans { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.bl-plan { background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.bl-plan.team { border-color: var(--accent); }
.bl-name { font-weight: 700; }
.bl-price { font-size: 22px; font-weight: 800; } .bl-price small { font-size: 12px; font-weight: 500; color: var(--muted); margin-left: 3px; }
.bl-plan .muted { font-size: 12.5px; flex: 1; }
.keybox { margin-top: 10px; font-size: 13px; color: var(--muted); }
.keybox summary { cursor: pointer; }
.keybox .row { display: flex; gap: 8px; margin-top: 8px; } .keybox .row input { flex: 1; }
.qr-info .row { display: flex; gap: 6px; }
.tm-who input { width: 180px; padding: 4px 8px; font-size: 13px; }
.tm-who a { color: var(--accent-text); text-decoration: none; margin-left: 4px; }
.tm-namecard { flex-wrap: wrap; } .tm-namecard input { flex: 1; min-width: 160px; max-width: 260px; }

/* Tài khoản (account.js) */
.avatar { display: inline-grid; place-items: center; border-radius: 50%; color: #fff; font-weight: 700; flex: none; object-fit: cover; background: var(--panel2); }
.avatar.ghost { background: var(--panel2); color: var(--muted); font-size: 14px; }
.acc-chip { display: flex; align-items: center; gap: 9px; width: 100%; background: var(--panel2); border: 1px solid var(--line); color: var(--text); border-radius: 10px; padding: 7px 9px; cursor: pointer; font: inherit; font-size: 13px; text-align: left; }
.acc-chip:hover { border-color: var(--accent); }
.acc-chip .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; max-width: 980px; }
.acc-side { display: flex; flex-direction: column; gap: 14px; }
.acc-profile { gap: 14px; }
.acc-av { display: flex; align-items: center; gap: 16px; }
.acc-av-btns { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.acc-av-btns .btn.small { width: auto; }
.acc-field { display: flex; flex-direction: column; gap: 4px; font-size: 13.5px; }
.acc-field > span { color: var(--muted); font-size: 12px; }
.acc-field .row { display: flex; gap: 8px; } .acc-field .row input { flex: 1; }
.acc-pay { width: 100%; border-collapse: collapse; font-size: 13px; }
.acc-pay td { padding: 7px 4px; border-bottom: 1px dashed var(--line); }
.acc-pay td.num { text-align: right; font-variant-numeric: tabular-nums; }
.acc-pay .st { font-size: 11.5px; padding: 2px 8px; border-radius: 99px; background: var(--panel2); color: var(--muted); }
.acc-pay .st.paid { background: color-mix(in srgb, var(--accent) 18%, var(--panel)); color: var(--ok); }
.tm-mem .row .avatar { margin-right: 2px; }
@media (max-width: 1000px) { .acc-grid { grid-template-columns: minmax(0, 1fr); } }

/* Nhóm — 3 cột như cây thư mục: Nhóm │ Mục việc │ Chi tiết */
.tm-tree { display: grid; grid-template-columns: 190px 220px minmax(0, 1fr); border: 1px solid var(--line); border-radius: 12px; background: var(--panel); min-height: 460px; height: calc(100vh - 150px); overflow: hidden; }
.tm-tree.c1 { grid-template-columns: 190px minmax(0, 1fr); }
.tm-col { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.tm-c1, .tm-c2 { border-right: 1px solid var(--line); padding: 8px; gap: 8px; }
.tm-c1 { background: var(--panel2); }
.tm-ch { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 4px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tm-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; min-height: 40px; }
.tm-node { display: flex; align-items: center; gap: 7px; padding: 7px 8px; border-radius: 7px; cursor: pointer; font-size: 13.5px; border: 1px solid transparent; }
.tm-node:hover { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.tm-node.on { background: color-mix(in srgb, var(--accent) 18%, transparent); border-color: color-mix(in srgb, var(--accent) 50%, transparent); font-weight: 600; }
.tm-nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.tm-ico { flex: none; }
.tm-star { color: #f59e0b; font-size: 12px; flex: none; }
.tm-tree .dot, .tm-dh .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; display: inline-block; }
.tm-add1 { display: flex; flex-direction: column; gap: 6px; border-top: 1px dashed var(--line); padding-top: 8px; }
.tm-add1 input[type=text] { padding: 6px 8px; font-size: 13px; }
.tm-add1 input[type=color] { width: 34px; flex: none; padding: 2px; }
.tm-empty1 { font-size: 12.5px; padding: 6px; }
.tm-detail { padding: 14px 16px; gap: 14px; overflow-y: auto; }
.tm-dh { display: flex; align-items: center; gap: 10px; font-size: 16px; }
.tm-box { display: flex; flex-direction: column; gap: 8px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.tm-bh { font-weight: 600; font-size: 13.5px; }
.tm-bm { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.tm-bn { width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: none; }
.tm-bs { width: 110px; text-align: right; white-space: nowrap; flex: none; }
.ic-sp { width: 26px; flex: none; }
.tm-hintbox { margin: auto; text-align: center; color: var(--muted); max-width: 320px; }
.tm-hi { font-size: 40px; opacity: .6; }
.tm-tools { border-top: 1px dashed var(--line); padding-top: 8px; font-size: 12.5px; }
.tm-tools summary { cursor: pointer; color: var(--muted); }
details.tm-tools[open] { display: flex; flex-direction: column; gap: 6px; max-height: 50%; overflow-y: auto; }
details.tm-tools input { padding: 5px 8px; font-size: 12.5px; }
.tm-mem1 { gap: 6px; font-size: 12.5px; }
.tm-tree .ic, .tm-mem1 .ic { background: none; border: 0; color: var(--muted); padding: 2px 6px; border-radius: 4px; cursor: pointer; flex: none; }
.tm-tree .ic:hover { color: var(--danger); background: var(--panel2); }
.tm-tree .btn.small { width: 100%; }
.tm-dh .btn.small { width: auto; }
.tm-inv { border-color: var(--accent); margin-bottom: 12px; }
[data-v="team"].has-dot::after { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #f87171; margin-left: 6px; vertical-align: middle; }
#v-team { container-type: inline-size; }
.tm-dh { flex-wrap: wrap; } .tm-dh b { min-width: 120px; }
.tm-bm .meter { min-width: 40px; }
@container (max-width: 980px) { .tm-tree { grid-template-columns: 160px 180px minmax(0, 1fr); } .tm-bn { width: 110px; } .tm-bs { width: auto; } }
@container (max-width: 760px) {
  .tm-tree, .tm-tree.c1 { grid-template-columns: minmax(0, 1fr); height: auto; }
  .tm-c1, .tm-c2 { border-right: 0; border-bottom: 1px solid var(--line); }
  .tm-list { flex-direction: row; flex-wrap: wrap; }
  .tm-bn { width: 90px; }
}
}
/* Lời mời gộp theo nhóm + lời nhắn; ghi chú việc; chat nhóm */
.tm-msg { margin-top: 8px; padding: 8px 12px; border-left: 3px solid var(--accent); background: var(--panel2); border-radius: 6px; white-space: pre-wrap; font-size: 13px; }
.tm-invform { display: flex; flex-direction: column; gap: 6px; }
.tm-invform textarea, .tm-add textarea, .tm-send textarea { resize: vertical; font: inherit; font-size: 13px; padding: 7px 9px; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 8px; }
.tm-flds { align-items: flex-end; flex-wrap: wrap; }
.tm-flds label { display: flex; flex-direction: column; gap: 3px; font-size: 11.5px; color: var(--muted); flex: 1; min-width: 140px; }
.tm-note { font-size: 12.5px; color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; margin: 2px 0; }
.tm-edit { align-items: stretch; }
.tm-chatnode { border-bottom: 1px dashed var(--line); border-radius: 7px 7px 0 0; margin-bottom: 4px; }
.tm-unread { background: #ef4444; color: #fff; font-size: 11px; font-weight: 700; border-radius: 99px; padding: 1px 7px; flex: none; }
.tm-chatcol { padding-bottom: 10px; overflow: hidden; }
.tm-chatlist { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 4px 2px; min-height: 0; }
.tm-day { align-self: center; font-size: 11px; color: var(--muted); background: var(--panel2); padding: 2px 10px; border-radius: 99px; margin: 6px 0; }
.tm-cm { display: flex; gap: 8px; align-items: flex-end; max-width: 78%; }
.tm-cm.mine { align-self: flex-end; flex-direction: row-reverse; }
.tm-bubble { background: var(--panel2); border-radius: 12px 12px 12px 4px; padding: 7px 11px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tm-cm.mine .tm-bubble { background: color-mix(in srgb, var(--accent) 22%, var(--panel2)); border-radius: 12px 12px 4px 12px; }
.tm-bubble b { font-size: 12px; color: var(--accent-text); }
.tm-body { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13.5px; }
.tm-bubble small { font-size: 10.5px; color: var(--muted); align-self: flex-end; }
.tm-cdel { color: var(--muted); text-decoration: none; margin-left: 4px; opacity: 0; } .tm-cm:hover .tm-cdel { opacity: 1; }
.tm-send { display: flex; gap: 8px; align-items: flex-end; border-top: 1px solid var(--line); padding-top: 10px; }
.tm-send textarea { flex: 1; }
.tm-add1 .row { flex-wrap: nowrap; } .tm-add1 .row input[type=text] { min-width: 0; }
/* Nhập kế hoạch → chia việc cho nhóm */
.imp-table .twho, .imp-table .tkind { white-space: nowrap; }
#impPreview:not(.team) .twho { display: none; }
#impPreview.team .tkind { display: none; }
.imp-teambar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: -4px 0 12px; padding: 10px 12px; background: var(--panel); border: 1px solid var(--accent); border-radius: var(--radius); }
.imp-teambar #iQ { flex: 1 1 220px; } .imp-teambar #iWho { flex: 2 1 280px; }
.imp-teambar .btn { width: auto; flex: none; }
.iwho { display: flex; align-items: center; gap: 6px; } .iwho select { padding: 4px 6px; font-size: 12.5px; max-width: 160px; }
.imp-table tr.hide { display: none; }
.imp-table tr.picked td { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.tm-tree .row { display: flex; gap: 8px; align-items: center; }
.tm-tree .tm-flds { align-items: flex-end; flex-wrap: wrap; }
.tm-tree .tm-flds label { flex: 1 1 130px; min-width: 120px; }
.tm-tree .tm-flds label select, .tm-tree .tm-flds label input { width: 100%; }
.tm-tree .tm-flds .btn { flex: none; }
#impPreview.team .ipersonal { display: none; }
#impPreview.team .imp-head { grid-template-columns: 2fr 1fr 1.6fr auto; }
/* Cây Dự án → Nhóm → Mục công việc */
.tm-grp { display: flex; flex-direction: column; }
.tm-tw { width: 14px; flex: none; color: var(--muted); font-size: 11px; text-align: center; cursor: pointer; }
.tm-kids { display: flex; flex-direction: column; gap: 1px; margin: 1px 0 4px 14px; padding-left: 8px; border-left: 1px dashed var(--line); }
.tm-sub { padding: 5px 8px; font-size: 13px; font-weight: 400; }
.tm-sub.on { font-weight: 600; }
.tm-addnode { color: var(--muted); }
.tm-addnode:hover { color: var(--accent-text); }
.tm-inline { display: flex; gap: 4px; align-items: center; padding: 2px 0; }
.tm-inline input { flex: 1; min-width: 0; padding: 5px 7px; font-size: 12.5px; }
.tm-inline .btn.small { width: auto; padding: 4px 8px; }
.tm-inline2 .btn { width: auto; }
.tm-role { font-size: 10.5px; font-weight: 600; color: var(--muted); background: var(--panel2); border-radius: 99px; padding: 1px 7px; margin-left: 4px; }
.tm-role.lead { color: #f59e0b; background: color-mix(in srgb, #f59e0b 15%, transparent); }
.tm-tip { font-size: 12px; }
.tm-lrow { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel2); cursor: pointer; font-size: 13.5px; }
.tm-lrow:hover { border-color: var(--accent); }
.tm-crumb { text-decoration: none; font-size: 13px; } .tm-crumb:hover { color: var(--accent-text); }
.tm-chathint { font-size: 12px; margin: -6px 0 0; }
/* Hướng dẫn từng bước (tour.js) */
#tour { position: fixed; inset: 0; z-index: 9999; display: none; }
#tour.on { display: block; }
.tour-hole { position: fixed; border-radius: 10px; box-shadow: 0 0 0 9999px rgba(0, 0, 0, .62); outline: 2px solid var(--accent); transition: all .25s ease; pointer-events: none; }
.tour-bubble { position: fixed; background: var(--panel); color: var(--text); border: 1px solid var(--accent); border-radius: 12px; padding: 14px 16px; box-shadow: 0 12px 40px rgba(0, 0, 0, .45); transition: left .25s ease, top .25s ease; }
.tour-top { display: flex; align-items: center; gap: 10px; }
.tour-num { width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: var(--on-accent); font-weight: 800; display: grid; place-items: center; flex: none; }
.tour-title { font-size: 15px; }
.tour-text { margin: 8px 0 12px; font-size: 13.5px; line-height: 1.5; color: var(--muted); }
.tour-foot { display: flex; align-items: center; gap: 6px; }
.tour-foot .btn.small { width: auto; }
.tour-count { font-size: 12px; }
/* Mua thêm chỗ (gói Cá nhân) */
.bl-seats { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; padding: 10px 12px; border: 1px dashed var(--line); border-radius: 10px; font-size: 13.5px; }
.bl-seats .row { display: flex; gap: 8px; align-items: center; }
.bl-seats .btn { width: auto; }
/* Mã hoá đầu-cuối */
.tm-lock { flex-wrap: wrap; } .tm-lock input { flex: 1; min-width: 200px; max-width: 280px; font-family: ui-monospace, monospace; letter-spacing: .05em; }
.e2e-card .row { display: flex; gap: 8px; flex-wrap: wrap; } .e2e-card .row .btn { width: auto; }
.e2e-card #accRecovery { flex: 1; font-family: ui-monospace, monospace; }
#e2eDlg { max-width: 460px; background: var(--panel); color: var(--text); border: 1px solid var(--accent); border-radius: 14px; padding: 20px; }
#e2eDlg::backdrop { background: rgba(0, 0, 0, .6); }
#e2eDlg .row { display: flex; gap: 8px; align-items: center; } #e2eDlg .btn { width: auto; }
.e2e-code { font: 700 18px ui-monospace, monospace; letter-spacing: .04em; white-space: nowrap; overflow-x: auto; text-align: center; padding: 14px; margin: 10px 0; border: 2px dashed var(--accent); border-radius: 10px; user-select: all; }

/* Nút "Có bản mới" cạnh chữ PRO */
.upd-badge { margin-left: 4px; font-size: 13px; line-height: 1; padding: 2px 4px; border: 0; border-radius: 6px; background: none; cursor: pointer; vertical-align: middle; animation: updPulse 2.4s ease-in-out infinite; }
.upd-badge.must { filter: hue-rotate(-40deg) saturate(2); }
.upd-badge[hidden] { display: none; }
@keyframes updPulse { 0%, 100% { box-shadow: 0 0 0 0 transparent; } 50% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); } }
.brand { white-space: nowrap; flex-wrap: wrap; row-gap: 4px; } .brand .upd-badge { margin-left: 0; }

.upd-btn { width: 100%; margin-top: 6px; font-size: 12.5px; padding: 6px 10px; border-color: var(--accent-text); color: var(--accent-text); }
.upd-btn.must { border-color: #ef4444; color: var(--bad); }
.upd-btn[hidden] { display: none; }

.upd-btn.busy { cursor: default; opacity: .9; display: flex; align-items: center; justify-content: center; gap: 8px; }
.upd-btn .spin { width: 13px; height: 13px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; display: inline-block; animation: updSpin .8s linear infinite; }
@keyframes updSpin { to { transform: rotate(360deg); } }

.app-ver { margin-top: 6px; font-size: 11px; color: var(--muted); opacity: .8; }

.tm-gear { opacity: .7; font-size: 14px; } .tm-gear:hover, .tm-gear.on { opacity: 1; color: var(--accent-text) !important; }
.tm-danger { border-color: color-mix(in srgb, #ef4444 40%, var(--line)); }
.tm-danger .btn { width: auto; align-self: flex-start; }

.sync-ok { color: var(--ok); margin: 6px 0; }

.ai-big { font-size: 22px; }
.ai-plan { border-color: color-mix(in srgb, #a855f7 45%, var(--line)); margin-bottom: 14px; }
.ai-plan textarea { width: 100%; box-sizing: border-box; }

.tm-ch { display: flex; align-items: center; gap: 6px; }
.tm-ai-box { margin: 8px 10px; padding: 10px 12px; border: 1px solid color-mix(in srgb, #a855f7 45%, var(--line)); border-radius: 10px; background: color-mix(in srgb, #a855f7 8%, transparent); display: flex; flex-direction: column; gap: 6px; }
.tm-ai-box p, .tm-ai-box ul { margin: 0; } .tm-ai-box ul { padding-left: 18px; }
.tm-ai-task { display: flex; gap: 8px; align-items: flex-start; }
.tm-report { white-space: pre-wrap; font: inherit; max-height: 55vh; overflow: auto; background: var(--panel2, rgba(0,0,0,.2)); padding: 10px 12px; border-radius: 8px; }
#aiReportDlg { width: min(640px, calc(100vw - 32px)); }
.ok-txt { color: var(--ok); }

/* Khung tóm tắt chat (cột chat hẹp): tiêu đề không bị bóp, ô chọn mục công việc đủ rộng */
.tm-ai-box .row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tm-ai-box .row > b.grow { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tm-ai-box .row > select { flex: 1 1 160px; min-width: 0; width: auto; }
.tm-ai-box .row > .btn, .tm-ai-box .row > small { flex: none; width: auto; }
