/* Màu thương hiệu Kiến Ngô: vàng (#FDDA0D) làm nền nhấn, chữ trên nền vàng màu sẫm; chữ / link nhấn dùng vàng đậm cho dễ đọc */
:root {
  --bg: #f3f4f2; --panel: #ffffff; --sunk: #eceeeb; --line: #d9ddd8; --line-soft: #e7e9e6;
  --fg: #1d2321; --muted: #5f6a66; --faint: #8a948f;
  --accent: #FDDA0D; --accent-strong: #E9C200; --accent-soft: #FFF6CC; --accent-fg: #1F1A00; --accent-ink: #8A6A00;
  --ok: #2f7a3e; --ok-bg: #e1f1e3; --warn: #9a6700; --warn-bg: #fbefcf; --bad: #b4372b; --bad-bg: #f9e0dc;
  --input: #fbfcfb; --focus: #C99A00;
  --f-ui: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
}
/* Nền trắng (mặc định) hoặc nền xám: người dùng chọn ở góc trên, lưu trong trình duyệt (data-theme trên thẻ html). */
:root[data-theme="gray"] {
  --bg: #2a2a2a; --panel: #333333; --sunk: #2e2e2e; --line: #474747; --line-soft: #3d3d3d;
  --fg: #ececec; --muted: #b3b3b3; --faint: #8c8c8c;
  --accent: #FDDA0D; --accent-strong: #E9C200; --accent-soft: #4a4214; --accent-fg: #1F1A00; --accent-ink: #FDDA0D;
  --ok: #7cd08b; --ok-bg: #233a28; --warn: #f0c24d; --warn-bg: #45391a; --bad: #f28b7d; --bad-bg: #4a2723;
  --input: #2f2f2f; --focus: #FDDA0D; color-scheme: dark;
}
:root:not([data-theme="gray"]) { --bg: #ffffff; --sunk: #f4f4f2; }
.logo-on-dark { display: none !important; }
:root[data-theme="gray"] .logo-on-light { display: none !important; }
:root[data-theme="gray"] .logo-on-dark { display: block !important; }
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--fg); font-family: var(--f-ui); font-size: 13.5px; line-height: 1.45; padding: 0 16px 40px; }
.wrap { max-width: 1560px; margin: 0 auto; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.mono { font-family: var(--f-mono); font-size: 12px; }
.dim { color: var(--faint); }
.err { color: var(--bad); font-size: 12px; }
.hint { font-size: 12px; color: var(--muted); }
h4 { margin: 0 0 6px; font-size: 12px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }

/* header */
.top { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; padding: 16px 0 12px; border-bottom: 1px solid var(--line); }
.brand { display: flex; flex-direction: column; gap: 2px; }
.brand small { color: var(--muted); font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; }
.brand h1 { margin: 0; font-size: 19px; font-weight: 700; }
.mods { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--panel); margin-left: auto; }
.mods a { padding: 8px 14px; color: var(--muted); text-decoration: none; font-weight: 500; border-right: 1px solid var(--line); }
.mods a:last-child { border-right: 0; }
.mods a.active { background: var(--accent); color: var(--accent-fg); }

/* buttons */
.btn { border: 1px solid var(--line); background: var(--panel); border-radius: 6px; padding: 6px 11px; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--accent); }
.btn.pri { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); font-weight: 600; }
.btn.pri:hover:not(:disabled) { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 3px 8px; font-size: 12px; }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.x { border: 0; background: none; color: var(--faint); cursor: pointer; border-radius: 4px; height: 24px; }
.x:hover { color: var(--bad); background: var(--bad-bg); }
.car { border: 0; background: none; cursor: pointer; width: 22px; height: 22px; border-radius: 4px; color: var(--muted); }
.car:hover { background: var(--line-soft); }

/* KPI strip */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin: 14px 0; }
.kpi { background: var(--panel); padding: 10px 14px; display: flex; flex-direction: column; gap: 2px; }
.kpi label { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.kpi b { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.kpi span { font-size: 12px; color: var(--muted); }
.kpi.flag b { color: var(--bad); }

/* toolbar */
.bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px 0; }
.bar .sp { flex: 1; }
.search { border: 1px solid var(--line); background: var(--input); border-radius: 6px; padding: 6px 10px; width: 240px; max-width: 100%; }
.searchbox { position: relative; display: inline-flex; max-width: 100%; }
.searchbox .search { padding-right: 28px; }
.searchbox .clear { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); border: 0; background: none; cursor: pointer; color: var(--muted); width: 22px; height: 22px; border-radius: 4px; }
.searchbox .clear:hover { background: var(--line-soft); color: var(--fg); }
.filterbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 6px 12px; margin-bottom: 8px; border-radius: 6px; background: var(--accent-soft); font-size: 12.5px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.seg button { border: 0; background: var(--panel); padding: 6px 10px; cursor: pointer; border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--accent-soft); font-weight: 600; }

/* tables */
.tw { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
table { border-collapse: collapse; width: 100%; }
table.big { min-width: 1100px; }
th { position: sticky; top: 0; background: var(--sunk); font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); font-weight: 600; text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; z-index: 1; }
th.num { text-align: right; }
td { padding: 5px 8px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
tr.grp td { background: var(--sunk); font-weight: 600; }
tr.grp .count { font-weight: 400; color: var(--faint); }
tr.grp2 td { background: color-mix(in srgb, var(--sunk) 50%, var(--panel)); font-weight: 500; }
tr.grp2 td:nth-child(2) { padding-left: 26px; }
.mini tr.grp2 td:first-child { padding-left: 20px; }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; align-items: start; }
.cat-box { border: 1px solid var(--line); border-radius: 6px; padding: 8px; background: var(--input); }
.cat-box .field { margin-bottom: 4px; flex-wrap: nowrap; }
.cat-box .cell { min-width: 0; }
.cat-grid { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
.cat-row { padding-left: 20px; margin-bottom: 4px; }
.cat-row select.cell { width: 130px; flex: none; font-size: 12px; color: var(--muted); }
tr.ln:hover td { background: color-mix(in srgb, var(--accent-soft) 45%, transparent); }
tr.ln.open td { background: var(--accent-soft); }
tr.det > td { background: var(--sunk); padding: 12px 14px 16px 44px; }
tr.sub td { font-size: 12.5px; color: var(--muted); }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 640px; }
.mini { width: 100%; font-size: 12.5px; margin-bottom: 8px; }
.mini th, .mini td { padding: 3px 6px; position: static; }
tfoot td { font-weight: 700; background: var(--sunk); border-top: 1px solid var(--line); }

/* inputs in tables */
.cell { border: 1px solid transparent; background: transparent; border-radius: 4px; padding: 4px 6px; width: 100%; font-variant-numeric: tabular-nums; }
.cell:hover { border-color: var(--line); }
.cell:focus { border-color: var(--focus); background: var(--input); outline: none; }
.cell.edit { border-color: var(--line); background: var(--input); }
.cell.r { text-align: right; }
.cell:disabled { border-color: transparent; background: transparent; cursor: default; }
input.bad, .cell.bad { border-color: var(--bad) !important; background: var(--bad-bg); }

/* chips */
.kind { font-size: 10.5px; padding: 0 5px; border-radius: 3px; border: 1px solid var(--line); color: var(--muted); letter-spacing: .03em; white-space: nowrap; }
.kind.dm { border-color: var(--accent-ink); color: var(--accent-ink); }
.pill { display: inline-block; text-align: center; border-radius: 999px; padding: 1px 8px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }

/* editor panels */
.detgrid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 20px; max-width: 1300px; align-items: start; }
.field { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.field input, .field select { border: 1px solid var(--line); background: var(--input); border-radius: 4px; padding: 4px 8px; }
textarea { width: 100%; min-height: 70px; border: 1px solid var(--line); background: var(--input); border-radius: 4px; padding: 6px 8px; resize: vertical; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 14px; margin-bottom: 12px; }
.note { padding: 8px 12px; border: 1px dashed var(--line); border-radius: 6px; color: var(--muted); font-size: 12.5px; margin: 8px 0; }
.note.warn { border-style: solid; border-color: var(--warn); background: var(--warn-bg); color: var(--fg); }
.errors { margin: 8px 0; padding: 8px 12px 8px 28px; background: var(--bad-bg); color: var(--bad); border-radius: 6px; font-size: 12.5px; }
.empty { padding: 28px; text-align: center; color: var(--muted); }

.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--fg); color: var(--bg); padding: 8px 14px; border-radius: 6px; font-size: 13px; z-index: 20; max-width: 90vw; }
.toast.error { background: var(--bad); color: #fff; }

#blazor-error-ui { background: var(--warn-bg); bottom: 0; box-shadow: 0 -1px 2px rgba(0,0,0,.2); display: none; left: 0; padding: .6rem 1.25rem .7rem; position: fixed; width: 100%; z-index: 1000; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }

@media (max-width: 800px) {
  .detgrid { grid-template-columns: 1fr; }
  .mods { margin-left: 0; }
  tr.det > td { padding-left: 12px; }
}

/* ---- thanh phân hệ trên cùng ---- */
.apps { display: flex; align-items: center; gap: 2px; padding: 8px 0 0; border-bottom: 2px solid var(--accent); }
.apps .logo { display: inline-flex; align-items: center; margin-right: 14px; padding-bottom: 4px; }
.apps .logo img { height: 42px; width: auto; display: block; }
.theme-switch { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.theme-switch button { border: 0; background: var(--panel); padding: 3px 8px; cursor: pointer; font-size: 12px; color: var(--muted); }
.theme-switch button.on { background: var(--accent); color: var(--accent-fg); font-weight: 600; }
.apps a { padding: 8px 16px; color: var(--muted); text-decoration: none; font-weight: 600; border-radius: 6px 6px 0 0; }
.apps a:hover { color: var(--fg); background: var(--line-soft); }
.apps a.on { background: var(--accent); color: var(--accent-fg); }
a { color: var(--accent-ink); }

/* ---- báo giá ---- */
.qhead .brand small a { color: var(--muted); }
.qhead h1 .btn { vertical-align: middle; }
.vers { display: inline-flex; flex-wrap: wrap; gap: 4px; align-items: center; margin-left: auto; }
.vers a, .vchip { display: inline-flex; gap: 4px; align-items: baseline; padding: 4px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--fg); text-decoration: none; font-weight: 600; margin: 1px 2px; }
.vers a small, .vchip small { font-weight: 400; color: var(--muted); font-size: 11px; }
.vers a.on { border-color: var(--accent); background: var(--accent-soft); }
.vchip.won { border-color: var(--ok); }
.vstate { display: inline-flex; gap: 6px; align-items: center; }
.tabs { display: flex; flex-wrap: wrap; gap: 0; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.tabs button { border: 0; background: none; padding: 9px 14px; cursor: pointer; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.on { color: var(--fg); border-bottom-color: var(--accent); font-weight: 600; }
.lvl { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--muted); }
tr.sec td { background: var(--accent); color: var(--accent-fg); font-weight: 700; }
tr.sec .car { color: var(--accent-fg); }
tr.sec .count, tr.grp .count { font-weight: 400; opacity: .8; }
.ovr { display: inline-flex; align-items: center; gap: 2px; justify-content: flex-end; width: 100%; }
.ovr .cell::placeholder { color: var(--faint); opacity: 1; }
.ovr.strong .cell, .ovr.strong .cell::placeholder { color: var(--fg); font-weight: 600; }
.ovr.set .cell { border-color: var(--warn); background: var(--warn-bg); font-weight: 600; }
.ovr .rst { border: 0; background: none; cursor: pointer; color: var(--warn); width: 18px; padding: 0; font-size: 13px; }
.ovr .rst:hover { color: var(--fg); }
.cell.chg { border-color: var(--warn); background: var(--warn-bg); }
.kind.ps { border-color: var(--warn); color: var(--warn); }
.lname b { font-weight: 500; }
.lname .desc { color: var(--muted); font-size: 12px; max-width: 560px; }
.sug { display: flex; flex-direction: column; align-items: flex-end; }
.sug button { border: 1px dashed var(--line); background: none; border-radius: 4px; padding: 1px 6px; cursor: pointer; font-variant-numeric: tabular-nums; }
.sug button:hover:not(:disabled) { border-color: var(--accent-ink); color: var(--accent-ink); }
.sug small { color: var(--faint); font-size: 10.5px; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dg { display: grid; grid-template-columns: minmax(110px, 1fr) minmax(150px, 1.5fr) 90px 26px; gap: 4px 6px; align-items: center; }
.dg .h { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.dg .r, .dg .v { text-align: right; font-variant-numeric: tabular-nums; }
.dg input { border: 1px solid var(--line); background: var(--input); border-radius: 4px; padding: 3px 6px; min-width: 0; }
.ms { position: relative; }
.ms summary { cursor: pointer; border: 1px solid var(--line); border-radius: 4px; padding: 4px 8px; background: var(--input); list-style: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 320px; }
.ms .msl { position: absolute; z-index: 5; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; max-height: 320px; overflow: auto; min-width: 300px; box-shadow: 0 6px 20px rgba(0,0,0,.15); }
.ms .msl label { display: flex; gap: 6px; padding: 2px 0; font-size: 12.5px; }
.ms .msh { font-size: 11px; text-transform: uppercase; color: var(--muted); margin-top: 6px; letter-spacing: .04em; }
.pill:not(.ok):not(.warn):not(.bad) { background: var(--line-soft); color: var(--muted); }

/* hộp thoại */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.35); display: flex; align-items: flex-start; justify-content: center; padding: 5vh 16px; z-index: 30; overflow: auto; }
.modal .box { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px; width: 760px; max-width: 100%; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.modal .box.wide { width: 1100px; }
.mhead { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.mhead h3 { margin: 0; }
.mhead .sp, .actions .sp { flex: 1; }

/* bản gửi khách */
.paper { background: #fff; color: #111; border: 1px solid var(--line); border-radius: 8px; padding: 28px; max-width: 1180px; font-family: "Times New Roman", serif; font-size: 13.5px; }
.paper .hint { color: #555; }
.paper .co { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.paper h2 { text-align: center; margin: 18px 0 12px; letter-spacing: .04em; }
.paper table { border-collapse: collapse; width: 100%; }
.paper th { position: static; background: #FDDA0D; color: #1F1A00; border: 1px solid #999; font-size: 12px; }
.paper td { border: 1px solid #bbb; padding: 4px 6px; vertical-align: top; }
.paper tr.s td { background: #FCE57A; font-weight: 700; }
.paper tr.g td { background: #FFF8D6; font-weight: 600; }
.paper tr.dgl td { color: #555; font-style: italic; font-size: 12.5px; }
.paper .pdesc { max-width: 420px; white-space: pre-line; }
.paper tfoot td { background: #f3f3f3; font-weight: 700; }
@media print {
  body { background: #fff; padding: 0; }
  .apps, .top, .kpis, .tabs, .noprint, .note, #blazor-error-ui, .toast { display: none !important; }
  .paper { border: 0; padding: 0; max-width: none; }
  /* in đúng màu như trên màn hình (trình duyệt mặc định bỏ màu nền khi in) */
  .paper, .paper * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  /* dòng Cộng / VAT / Tổng chỉ in một lần ở cuối, không lặp ở chân mỗi trang; tiêu đề cột vẫn lặp đầu mỗi trang */
  .paper tfoot { display: table-row-group; }
  .paper tr { break-inside: avoid; }
  .paper tr.s, .paper tr.g { break-after: avoid; }
}
@page { size: A4; margin: 12mm 10mm; }
.vers a.won { border-color: var(--ok); }
.vers a.won small, .vchip.won small { color: var(--ok); font-weight: 600; }
.seg .cnt { color: var(--muted); font-weight: 400; margin-left: 2px; font-variant-numeric: tabular-nums; }
.kind.gk { border-color: var(--line); color: var(--muted); }
.kind.tm { border-color: var(--ok); color: var(--ok); }
.kind.tt { border-color: #7a5bb5; color: #7a5bb5; }
details.promote summary { cursor: pointer; color: var(--accent-ink); font-size: 12.5px; }

.addbar { display: flex; flex-wrap: wrap; align-items: stretch; border: 1px solid var(--accent); border-radius: 8px; overflow: hidden; background: var(--panel); margin-top: 12px; }
.addbar .lbl { display: flex; align-items: center; padding: 0 14px; background: var(--accent); color: var(--accent-fg); font-weight: 600; white-space: nowrap; }
.addbar button { flex: 1 1 150px; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; border: 0; border-left: 1px solid var(--line); background: none; padding: 7px 14px; cursor: pointer; text-align: left; }
.addbar button:first-of-type { border-left: 0; }
.addbar button:hover:not(:disabled) { background: var(--accent-soft); }
.addbar button:disabled { opacity: .45; cursor: not-allowed; }
.addbar button small { color: var(--muted); font-size: 11.5px; }

.params { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.params label { display: inline-flex; align-items: center; gap: 4px; }
.qa-res { font-size: 12.5px; white-space: nowrap; }
.dg input.asm { color: var(--muted); }

.apps .acct { margin-left: auto; display: inline-flex; align-items: center; gap: 10px; font-size: 12.5px; padding-bottom: 4px; }
.apps .acct small { color: var(--muted); }
.apps .acct a.lnk { padding: 0; font-weight: 500; color: var(--accent-ink); border-radius: 0; }
.apps .acct a.lnk:hover { background: none; text-decoration: underline; }

.paper .co .ver { align-self: flex-start; text-align: right; white-space: nowrap; }
.paper .cust { margin-top: 12px; font-size: 15px; line-height: 1.5; }
.paper .cust span { display: inline-block; min-width: 95px; color: #444; }
.paper .co img { height: 46px; width: auto; display: block; margin-bottom: 6px; }

.lockbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ---- Marketing · nội dung ---- */
.mods .soon { padding: 8px 14px; color: var(--faint); border-right: 1px solid var(--line); cursor: default; }
.cst { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--line-soft); color: var(--muted); white-space: nowrap; }
.cst.st-1 { background: #FFF1B8; color: #7a5c00; }
.cst.st-2, .cst.st-3 { background: #DCEBFF; color: #1f4f99; }
.cst.st-4 { background: #EADCFF; color: #5b2c99; }
.cst.st-5 { background: var(--ok-bg); color: var(--ok); }
.cst.st-6 { text-decoration: line-through; }
.cst.rv-1 { background: #FFE2C2; color: #8a4500; }
.cst.rv-2 { background: var(--bad-bg); color: var(--bad); }
:root[data-theme="gray"] .cst.st-1 { background: #4a4214; color: #FDDA0D; }
:root[data-theme="gray"] .cst.st-2, :root[data-theme="gray"] .cst.st-3 { background: #1f3350; color: #9cc3ff; }
:root[data-theme="gray"] .cst.st-4 { background: #352650; color: #cfaaff; }
:root[data-theme="gray"] .cst.rv-1 { background: #4d3015; color: #ffb36b; }
.kanban { display: grid; grid-template-columns: repeat(8, minmax(165px, 1fr)); gap: 10px; overflow-x: auto; padding-bottom: 6px; }
.kcol { background: var(--sunk); border: 1px solid var(--line); border-radius: 8px; padding: 8px; min-height: 160px; border-top: 3px solid var(--line); }
.kcol.st-1 { border-top-color: #E9C200; } .kcol.st-2, .kcol.st-3 { border-top-color: #3b7be0; }
.kcol.st-4 { border-top-color: #8a4fd6; } .kcol.st-5 { border-top-color: var(--ok); }
.kcol.rv-1 { border-top-color: #f08a1c; background: color-mix(in srgb, #f08a1c 6%, var(--sunk)); }
.kcol.rv-2 { border-top-color: var(--bad); background: color-mix(in srgb, var(--bad) 5%, var(--sunk)); }
.kcol.rv-2 + .kcol { margin-left: 8px; }
.khint { font-size: 11px; color: var(--faint); margin: -4px 2px 8px; }
.kcol h4 { display: flex; justify-content: space-between; margin: 2px 2px 8px; }
.kcard { display: flex; flex-direction: column; gap: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 8px; margin-bottom: 8px; color: var(--fg); text-decoration: none; }
.kcard:hover { border-color: var(--accent-ink); }
.kcard b { font-weight: 600; line-height: 1.3; }
.kmeta { display: flex; flex-wrap: wrap; gap: 4px 8px; font-size: 11.5px; color: var(--muted); align-items: center; }
a.dropped { margin-left: 10px; color: var(--faint); text-decoration: line-through; }
.calwrap { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 12px; align-items: start; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--line); gap: 1px; }
.calh { background: var(--sunk); text-align: center; font-size: 11px; font-weight: 600; color: var(--muted); padding: 4px; }
.cald { background: var(--panel); min-height: 96px; padding: 4px; display: flex; flex-direction: column; gap: 3px; }
.cald.other { background: var(--sunk); opacity: .6; }
.cald.today { box-shadow: inset 0 0 0 2px var(--accent); }
.cald .dn { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.calnew { border: 0; background: none; color: var(--faint); cursor: pointer; width: 18px; height: 18px; border-radius: 4px; padding: 0; }
.calnew:hover { background: var(--accent); color: var(--accent-fg); }
.calitem { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 4px; font-size: 11.5px; line-height: 1.25; padding: 2px 4px; border-radius: 4px; background: var(--line-soft); border-left: 3px solid var(--faint); overflow: hidden; }
.calitem a { color: var(--fg); text-decoration: none; overflow: hidden; text-overflow: ellipsis; flex: 1 1 0; min-width: 0; }
.calitem .wipst { flex-basis: 100%; font-size: 10.5px; color: var(--faint); }
.calitem .x { margin-left: auto; }
.calitem.ready { border-left-color: #8a4fd6; }
.calitem.pub { border-left-color: var(--ok); opacity: .75; }
.calitem.wip { background: transparent; border: 1px dashed var(--line); border-left: 3px dashed var(--faint); opacity: .8; }
.legend { display: inline-flex; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); }
.legend .lg { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-left: 6px; }
.lg.ready { background: #8a4fd6; } .lg.pub { background: var(--ok); } .lg.wip { border: 1px dashed var(--faint); }
.unsched { max-height: 640px; overflow: auto; }
.cgrid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 14px; align-items: start; margin-top: 12px; }
.titlebox { font-size: 20px; font-weight: 700; border: 1px solid transparent; background: transparent; border-radius: 6px; padding: 2px 6px; width: 100%; color: var(--fg); }
.titlebox:hover:not(:disabled), .titlebox:focus { border-color: var(--line); background: var(--input); }
.chip { border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 3px 10px; cursor: pointer; font-size: 12.5px; }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); font-weight: 600; }
.scenes textarea.cell { min-height: 46px; resize: vertical; font-size: 12.5px; }
.cell.done { text-decoration: line-through; color: var(--faint); }
.thread { display: flex; flex-direction: column; gap: 6px; max-height: 360px; overflow: auto; margin-bottom: 8px; }
.msg { background: var(--sunk); border-radius: 6px; padding: 6px 8px; font-size: 12.5px; }
.msg.me { background: var(--accent-soft); }
.msg.sys { background: transparent; border: 1px dashed var(--line); }
.msg .who { color: var(--muted); font-size: 11.5px; margin-right: 6px; }
.msg .txt { white-space: pre-line; margin-top: 2px; }
@media (max-width: 1000px) { .cgrid, .calwrap { grid-template-columns: 1fr; } }

.lname b.noname { color: var(--warn); font-weight: 500; font-style: italic; }
tr.ln.flash td { animation: flashrow 1.8s ease-out; }
@keyframes flashrow { 0% { background: var(--accent); } 100% { background: transparent; } }

.newidea { margin-top: 12px; }
.newidea h4 { margin: 0 0 8px; }
.newidea .field { flex-wrap: wrap; }
.newidea .field > label { width: 70px; }
.newidea .field > label + .chips, .newidea select + label { margin-left: 0; }
h4.sect { margin: 16px 0 0; }
.newidea .chips { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.steps { display: flex; list-style: none; padding: 0; margin: 10px 0 0; gap: 0; flex-wrap: wrap; }
.steps li { padding: 5px 14px 5px 18px; background: var(--sunk); color: var(--muted); font-size: 12.5px; clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 50%, calc(100% - 8px) 100%, 0 100%, 8px 50%); margin-right: -4px; }
.steps li:first-child { clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 50%, calc(100% - 8px) 100%, 0 100%); padding-left: 12px; }
.steps li small { color: var(--faint); font-size: 10.5px; }
.steps li.done { background: var(--ok-bg); color: var(--ok); }
.steps li.now { background: var(--accent); color: var(--accent-fg); font-weight: 600; }
.steps li.now small { color: inherit; }
.msg .ev { font-weight: 600; }

textarea.locked { background: var(--sunk); color: var(--muted); cursor: default; resize: none; }

.quickadd { display: inline-flex; gap: 4px; margin-left: 14px; float: right; }
.quickadd .btn.ghost { padding: 0 8px; font-size: 12px; color: var(--muted); font-weight: 500; }
.quickadd .btn.ghost:hover { color: var(--accent-fg); background: var(--accent); }

/* ---- Báo giá dạng Excel ---- */
table.sheet { min-width: 1500px; font-size: 13px; }
table.sheet th { white-space: nowrap; font-size: 11.5px; }
table.sheet td { padding: 3px 6px; vertical-align: top; }
table.sheet tr.ln td { border-top: 1px solid var(--line); }
table.sheet .cell.edit { width: 100%; min-width: 0; padding: 2px 4px; }
table.sheet td.nm { position: relative; }
table.sheet td.nm .b { font-weight: 600; }
table.sheet td.desc { font-size: 12.5px; color: var(--muted); max-width: 340px; }
table.sheet td.desc textarea { width: 100%; resize: vertical; font-size: 12.5px; }
table.sheet td.kindc { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
table.sheet td.b, table.sheet .num b { font-weight: 600; }
table.sheet .adddg { display: none; position: absolute; right: 8px; bottom: -9px; z-index: 2; border: 1px solid var(--line); background: var(--panel); color: var(--muted); border-radius: 4px; font-size: 11px; padding: 0 6px; cursor: pointer; }
table.sheet tr.ln:hover .adddg { display: inline-block; }
table.sheet .adddg:hover { background: var(--accent); color: var(--accent-fg); }
table.sheet tr.dgr td { border-top: 0; padding-top: 0; padding-bottom: 1px; font-style: italic; color: var(--muted); font-size: 12.5px; }
table.sheet tr.dgr .cell.edit { font-style: italic; color: var(--muted); background: transparent; border-color: transparent; }
table.sheet tr.dgr .cell.edit:hover:not(:disabled), table.sheet tr.dgr .cell.edit:focus { border-color: var(--line); background: var(--input); }
table.sheet tr.dgr td:nth-child(2) .cell { padding-left: 14px; }
table.sheet .lnv { display: inline-block; padding: 0 6px; border-radius: 4px; }
table.sheet .lnv.ok { background: var(--ok-bg); color: var(--ok); }
table.sheet .lnv.warn { background: var(--warn-bg, #FFF1B8); color: var(--warn, #8a6a00); }
table.sheet .lnv.bad { background: var(--bad-bg); color: var(--bad); }
table.sheet tfoot td { font-weight: 700; background: var(--sunk); }
table.sheet textarea.grow { field-sizing: content; resize: none; min-height: 0; overflow: hidden; line-height: 1.3; font-family: inherit; font-size: inherit; }
table.sheet td.code { width: 96px; }
table.sheet td.code .cell { width: 92px; color: var(--muted); }
table.sheet button.more { border: 1px solid transparent; background: none; color: var(--muted); border-radius: 4px; padding: 0 6px; cursor: pointer; font-size: 15px; line-height: 1.2; }
table.sheet button.more:hover, table.sheet button.more.on { border-color: var(--line); background: var(--accent); color: var(--accent-fg); }
table.sheet select.cell { width: 100%; }
table.sheet td.hdl { padding: 2px 0 0 2px; width: 22px; }
table.sheet button.grip { border: 1px solid transparent; background: none; color: var(--faint); border-radius: 4px; padding: 0 3px; cursor: grab; font-size: 14px; line-height: 1.2; }
table.sheet button.grip:hover, table.sheet button.grip.on { border-color: var(--line); background: var(--accent); color: var(--accent-fg); }
table.sheet button.grip:active { cursor: grabbing; }
table.sheet td.stt { white-space: nowrap; }
table.sheet td.stt .car { margin-right: 2px; }
table.sheet tr.dragging td { opacity: .45; }
table.sheet tr.ln.dropto td, table.sheet tr.dgr.dropto td { box-shadow: inset 0 -3px 0 var(--accent-ink); }
table.sheet tr.grp.dropto td { box-shadow: inset 0 3px 0 var(--accent-ink); }
.ctxback { position: fixed; inset: 0; z-index: 40; }
.ctxmenu { position: fixed; z-index: 41; min-width: 220px; max-width: 320px; max-height: 480px; overflow-y: auto; overscroll-behavior: contain; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.18); padding: 6px 0; font-size: 13px; }
.ctxmenu .ctxh { padding: 4px 12px 6px; color: var(--muted); font-size: 12px; border-bottom: 1px solid var(--line-soft); margin-bottom: 4px; }
.ctxmenu .ctxsec { padding: 6px 12px 2px; font-weight: 700; font-size: 11.5px; color: var(--accent-ink); text-transform: uppercase; }
.ctxmenu .ctxi { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 4px 12px 4px 20px; cursor: pointer; color: var(--fg); font: inherit; }
.ctxmenu .ctxi:hover:not(:disabled) { background: var(--accent); color: var(--accent-fg); }
.ctxmenu .ctxi.here { color: var(--faint); cursor: default; }
.ctxmenu .ctxsep { border-top: 1px solid var(--line-soft); margin: 4px 0; }
table.sheet .kc { display: inline-block; font-size: 10.5px; padding: 0 5px; border: 1px solid var(--line); border-radius: 3px; color: var(--muted); white-space: nowrap; }
table.sheet .kc.k0 { border-color: var(--accent-ink); color: var(--accent-ink); }
table.sheet .kc.k2 { border-color: var(--ok); color: var(--ok); }
table.sheet .kc.k3 { border-color: #7a5bb5; color: #7a5bb5; }
table.sheet .kc.ps { border-style: dashed; }
table.sheet td.desc.hasnorm span { cursor: help; text-decoration: underline dotted var(--faint); text-underline-offset: 3px; }
table.sheet td.dgl { text-align: right; white-space: nowrap; padding-right: 2px; }
table.sheet .dgtools { display: inline-flex; gap: 1px; visibility: hidden; }
table.sheet tr.dgr:hover .dgtools, table.sheet tr.dgr:focus-within .dgtools { visibility: visible; }
table.sheet .dgtools .x { font-size: 11px; padding: 0 4px; }
table.sheet td.code { position: relative; }
table.sheet td.code .kc { display: inline-block; margin-top: 3px; }
.pickbox { position: absolute; left: 0; top: calc(100% - 18px); z-index: 30; width: 380px; max-height: 280px; overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 8px 22px rgba(0,0,0,.16); padding: 4px 0; }
.pickbox .pk { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 4px 10px; cursor: pointer; font: inherit; font-size: 12.5px; line-height: 1.35; color: var(--fg); white-space: normal; }
.pickbox .pk b { font-family: var(--mono, monospace); font-weight: 600; margin-right: 4px; }
.pickbox .pk span { color: var(--muted); }
.pickbox .pk small { color: var(--faint); margin-left: 4px; }
.pickbox .pk:hover { background: var(--accent); }
.pickbox .pk:hover span, .pickbox .pk:hover small { color: var(--accent-fg); }
.pickbox .pk.cur { background: var(--accent-soft); }
table.sheet tr.dgr.ttl td { font-style: normal; }
table.sheet tr.dgr.ttl td:nth-child(2) .cell { font-weight: 600; color: var(--fg); font-style: normal; padding-left: 4px; text-decoration: underline; text-underline-offset: 3px; }
table.sheet td.del { text-align: center; }
table.sheet td.del .x { opacity: .3; }
table.sheet tr.ln:hover td.del .x { opacity: 1; }
/* bảng báo giá: cuộn trong khung để dòng tiêu đề cột luôn hiện */
.tw.sheetwrap { overflow: auto; max-height: calc(100vh - 150px); }
table.sheet thead th { position: sticky; top: 0; z-index: 5; background: var(--sunk); box-shadow: inset 0 -1px 0 var(--line); }
table.sheet tr.dgr .dgtools, table.sheet tr.dgr .dgtools .x { font-style: normal; }
table.sheet th .colbtn { border: 1px solid transparent; background: none; color: var(--faint); border-radius: 3px; padding: 0 3px; margin-left: 2px; cursor: pointer; font-size: 12px; line-height: 1; visibility: hidden; }
table.sheet th:hover .colbtn.hide { visibility: visible; }
table.sheet th .colbtn:hover { border-color: var(--line); background: var(--accent); color: var(--accent-fg); }
table.sheet th.colx { width: 18px; min-width: 18px; max-width: 18px; padding: 0; text-align: center; }
table.sheet th.colx .colbtn { visibility: visible; margin: 0; color: var(--accent-ink); font-weight: 700; }
.vnote { display: flex; align-items: flex-start; gap: 8px; margin-top: 10px; }
.vnote label { font-size: 12px; font-weight: 600; color: var(--muted); padding-top: 5px; white-space: nowrap; }
.vnote textarea { flex: 1; field-sizing: content; min-height: 30px; resize: vertical; font: inherit; font-size: 13px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--input, var(--panel)); color: var(--fg); }
.vnote textarea:focus { border-color: var(--accent-ink); outline: none; }
.paper .cust .vn { white-space: pre-line; margin-top: 2px; }
.paper .cust .vn span { vertical-align: top; }
.panel.links .linkbtn { min-width: 58px; text-align: center; }
/* ---- Marketing · kho source ---- */
.srcadd { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }
.srcadd input { flex: 1 1 180px; }
.srcadd .src-url { flex: 3 1 360px; font-family: var(--mono, monospace); font-size: 12.5px; }
.tagcloud { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 10px; align-items: center; }
.tag { border: 1px solid var(--line); background: var(--panel); color: var(--accent-ink); border-radius: 999px; padding: 1px 9px; cursor: pointer; font-size: 12.5px; margin: 1px 2px 1px 0; }
.tag small { color: var(--faint); margin-left: 2px; }
.tag.sm { font-size: 11.5px; padding: 0 7px; }
.tag:hover, .tag.on { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.tag.on small { color: inherit; }
table.srcs td { vertical-align: top; }
table.srcs .small { font-size: 11.5px; }
table.srcs .srcpath { max-width: 520px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.srcs td.acts { white-space: nowrap; }
.srcedit { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.srcedit input { flex: 1 1 160px; }
.srcedit .src-url { flex: 3 1 320px; font-family: var(--mono, monospace); font-size: 12.5px; }
.modal .field label.w90 { width: 90px; flex: none; }
button.linkish { border: 0; background: none; padding: 0; color: var(--accent-ink); cursor: pointer; font: inherit; text-align: left; }
button.linkish:hover { text-decoration: underline; }
/* ---- Quản trị · hợp đồng ---- */
.cst.ct-1 { background: #DCEBFF; color: #1f4f99; }
.cst.ct-2 { background: var(--ok-bg); color: var(--ok); }
.cst.ct-3 { text-decoration: line-through; }
h1.cthead { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
h1.cthead .titlebox { font-size: 20px; }
.words { margin: 8px 0 2px; }
table.pay td { vertical-align: middle; }
table.pay tr.done td { background: color-mix(in srgb, var(--ok-bg) 50%, transparent); }
details.panel > summary { cursor: pointer; list-style: revert; }
.pl5 { margin-top: 8px; }
.pl5 table { font-size: 12.5px; }
.pl5 tr.s td { background: var(--accent); font-weight: 700; }
.pl5 tr.g td { background: var(--sunk); font-weight: 600; }
.pl5 .pdesc { max-width: 420px; color: var(--muted); }
.printonly { display: none; }
.ctprint h3 { font-size: 14px; margin: 18px 0 6px; }
@media print {
  .printonly { display: block; }
  .ctprint .pl5 { margin: 0; }
  .ctprint .pl5 tr.s td { background: #FCE57A; }
  .ctprint .pl5 tr.g td { background: #FFF8D6; }
}
.cttabs { display: flex; flex-wrap: wrap; gap: 2px; margin-top: 12px; border-bottom: 1px solid var(--line); }
.cttabs button { border: 0; background: none; padding: 8px 12px; cursor: pointer; color: var(--muted); font: inherit; border-bottom: 2px solid transparent; }
.cttabs button.on { color: var(--fg); font-weight: 600; border-bottom-color: var(--accent); }
table.clauses td { vertical-align: top; }
table.clauses textarea.cell { width: 100%; }
table.clauses textarea.grow { field-sizing: content; resize: none; min-height: 0; overflow: hidden; line-height: 1.35; font-family: inherit; font-size: inherit; }
table.clauses.art textarea.cell { font-size: 12.5px; line-height: 1.45; }
table.clauses td.acts { white-space: nowrap; }
/* hợp đồng giấy */
.paper.contract { font-size: 13.5px; line-height: 1.5; }
.paper.contract table.ctop { width: 100%; border: 0; }
.paper.contract table.ctop td { border: 0; text-align: center; vertical-align: top; width: 50%; }
.paper.contract .u { text-decoration: underline; }
.paper.contract h2 { margin-top: 18px; }
.paper.contract p.c { text-align: center; }
.paper.contract table.parties { border: 0; width: auto; margin: 6px 0; }
.paper.contract table.parties td { border: 0; padding: 1px 8px 1px 0; }
.paper.contract table.parties td.lbl { width: 170px; padding-left: 24px; }
.paper.contract h4.art { margin: 12px 0 2px; font-size: 13.5px; }
.paper.contract .body { white-space: pre-line; text-align: justify; }
.paper.contract table.sign { width: 100%; border: 0; margin-top: 24px; break-inside: avoid; }
.paper.contract table.sign td { border: 0; text-align: center; width: 50%; }
.paper.contract table.sign tr.space td { height: 90px; }
.paper.contract .pb { break-after: page; }
.paper.contract h3 { font-size: 14px; margin: 18px 0 6px; }
.rowtools { display: inline-flex; gap: 1px; white-space: nowrap; }
.rowtools .x { font-size: 12px; padding: 0 5px; }
table.pay td.acts { white-space: nowrap; }
/* xem trước hợp đồng trên màn hình: giống tờ A4 */
.paper.contract.preview { display: block; max-width: 210mm; margin: 0 auto 24px; padding: 18mm 16mm; box-shadow: 0 2px 14px rgba(0,0,0,.12); }
.paper.contract.preview .pb { border-top: 1px dashed #bbb; margin: 28px -16mm; }
@media print {
  .paper.contract.preview { box-shadow: none; padding: 0; max-width: none; margin: 0; }
  .paper.contract.preview .pb { border: 0; margin: 0; }
}
table.pkalloc tr.pkover td { background: color-mix(in srgb, var(--accent, #2563eb) 9%, transparent); }
table.pkalloc select.cell { width: 100%; }
table.pkalloc { min-width: 0; width: 100%; }
table.pkalloc td:nth-child(2) { min-width: 220px; }
table.pkpk td:nth-child(2) input { min-width: 170px; }
table.pkpk td:nth-child(6) input { width: 56px; }
table.pkpk td:nth-child(9) input { min-width: 110px; }
table.pkpk tr.pkdg td { border-top: 0; padding-top: 0; padding-bottom: 1px; font-style: italic; color: var(--muted); font-size: 12.5px; }
table.pkpk tr.pkdg.ttl td { font-weight: 600; }
table.pkpk tr.pkdg .pkdgin { display: flex; gap: 6px; padding-left: 14px; }
table.pkpk tr.pkdg .pkdgin input:first-child { flex: 0 1 140px; min-width: 70px; }
table.pkpk tr.pkdg .pkdgin input:last-child { flex: 1; min-width: 90px; }
table.pkpk td.pkq { position: relative; text-align: right; }
table.pkpk .adddg { display: none; position: absolute; right: 4px; bottom: -9px; z-index: 2; border: 1px solid var(--line); background: var(--panel); color: var(--muted); border-radius: 4px; font-size: 11px; padding: 0 6px; cursor: pointer; white-space: nowrap; }
table.pkpk tr:hover .adddg { display: inline-block; }
table.pkpk .adddg:hover { background: var(--accent); color: var(--accent-fg); }
/* ---- Nhân sự ---- */
.monthpick { display: inline-flex; align-items: center; gap: 6px; }
.monthpick b { min-width: 110px; text-align: center; }
.mk { display: inline-block; min-width: 22px; padding: 0 4px; border-radius: 4px; font-size: 11.5px; font-weight: 700; text-align: center; line-height: 18px; background: var(--line); color: var(--fg, inherit); }
.mk-0 { background: #d7f0dc; color: #17642b; }
.mk-6 { background: #d6e8fb; color: #144a86; }
.mk-1 { background: #fff1c7; color: #7a5a00; }
.mk-2 { background: #fde3c8; color: #8a4500; }
.mk-3 { background: #f7d6e6; color: #8a1f55; }
.mk-4 { background: #e4e4e4; color: #555; }
.mk-5 { background: #e6dcfb; color: #4b2a92; }
.panel.today { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin-top: 12px; }
.marks { display: flex; flex-wrap: wrap; gap: 6px; }
.mkbtn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--panel); border-radius: 6px; padding: 4px 10px; cursor: pointer; font: inherit; font-size: 13px; color: inherit; }
.mkbtn:hover:not(:disabled) { border-color: var(--accent); }
.mkbtn.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset; }
.mkbtn:disabled { opacity: .45; cursor: not-allowed; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; max-width: 760px; }
.cal-h { font-size: 11px; text-transform: uppercase; color: var(--muted); text-align: center; padding: 2px 0; }
.cal-d { position: relative; min-height: 58px; border: 1px solid var(--line); background: var(--panel); border-radius: 6px; padding: 4px 6px; text-align: left; cursor: pointer; font: inherit; color: inherit; display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start; }
.cal-d.empty { border: 0; background: none; cursor: default; }
.cal-d .dn { font-size: 12px; color: var(--muted); }
.cal-d.sun { background: var(--bg, transparent); opacity: .7; }
.cal-d.today { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.cal-d.sel { box-shadow: 0 0 0 2px var(--accent) inset; }
.cal-d.future .dn { opacity: .6; }
.cal-d .miss { color: #c0392b; font-weight: 700; }
.cal-d .nt { position: absolute; right: 5px; top: 3px; font-size: 11px; color: var(--muted); }
.cal-d .mk { font-size: 13px; line-height: 22px; min-width: 30px; }
.panel.daypick { margin-top: 10px; max-width: 760px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; margin-top: 10px; }
.legend > span { display: inline-flex; align-items: center; gap: 5px; }
table.att { border-collapse: separate; border-spacing: 0; }
table.att th.d, table.att td.d { width: 30px; min-width: 30px; padding: 2px 1px; text-align: center; }
table.att th.d small { display: block; font-size: 9.5px; color: var(--muted); font-weight: 400; }
table.att .sun { background: color-mix(in srgb, var(--line) 45%, transparent); }
table.att th.today { color: var(--accent); }
table.att td.d { cursor: pointer; }
table.att td.d:hover { box-shadow: 0 0 0 1px var(--accent) inset; }
table.att td.d.sel { box-shadow: 0 0 0 2px var(--accent) inset; }
table.att td.d.out { background: repeating-linear-gradient(45deg, transparent 0 4px, color-mix(in srgb, var(--line) 60%, transparent) 4px 5px); }
table.att .stick { position: sticky; left: 0; background: var(--panel); z-index: 1; white-space: nowrap; min-width: 180px; }
table.att td.d .mk { min-width: 0; padding: 0 2px; font-size: 10.5px; }
.hrform h4 { margin: 14px 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.hrgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px 12px; }
.hrgrid label { display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; color: var(--muted); }
.hrgrid label.w2 { grid-column: span 2; }
.hrgrid input, .hrgrid select { border: 1px solid var(--line); background: var(--input); border-radius: 4px; padding: 5px 8px; color: var(--fg, inherit); font: inherit; font-size: 14px; }
@media (max-width: 600px) { .hrgrid label.w2 { grid-column: span 1; } .cal-d { min-height: 46px; } }
.mk-7 { background: #d3f1ee; color: #0d5e57; }
.mk-8 { background: #e2f4d2; color: #3c6312; }
.cal-d.sat .dn small { color: var(--muted); }
.cal-d.sat { background: linear-gradient(180deg, var(--panel) 50%, color-mix(in srgb, var(--line) 35%, var(--panel)) 50%); }
table.att td.d.sat { background: linear-gradient(180deg, transparent 50%, color-mix(in srgb, var(--line) 40%, transparent) 50%); }
table.att .wt { margin-left: 4px; font-size: 10px; font-weight: 700; padding: 0 4px; border-radius: 3px; background: var(--accent-soft); color: var(--accent-ink); }
table.att small.ok { color: var(--ok); }
.panel.today.locked { opacity: .85; }
table.mini { width: 100%; font-size: 13px; }
table.mini td { padding: 3px 6px; border-top: 1px solid var(--line-soft); }
.mk2 { display: inline-flex; gap: 1px; }
.mk2 .mk:first-child { border-radius: 4px 0 0 4px; }
.mk2 .mk:last-child { border-radius: 0 4px 4px 0; }
.mk.none { background: transparent; color: var(--faint); box-shadow: 0 0 0 1px var(--line) inset; }
.cal-d .mk2 .mk { font-size: 12px; line-height: 22px; min-width: 24px; }
table.att td.d .mk2 .mk { min-width: 0; padding: 0 1px; font-size: 9.5px; }
table.att th.d, table.att td.d { width: 34px; min-width: 34px; }
.daymarker { display: grid; gap: 6px; }
.dmrow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.dmrow .dml { width: 74px; font-weight: 600; font-size: 13px; }
.dmrow .dml small { display: block; font-weight: 400; color: var(--muted); font-size: 10.5px; line-height: 1.2; }
.dmrow.extra { opacity: .85; }
.dmrow .marks .mkbtn { padding: 3px 8px; }
/* thêm ngay sau một dòng (hiện khi rê chuột) */
table.sheet .addafter { display: none; position: absolute; left: 8px; bottom: -10px; z-index: 3; gap: 2px; }
table.sheet tr.ln:hover .addafter { display: inline-flex; }
table.sheet .addafter button { border: 1px solid var(--line); background: var(--panel); color: var(--muted); border-radius: 4px; font-size: 11px; padding: 0 6px; cursor: pointer; white-space: nowrap; font-style: normal; }
table.sheet .addafter button:hover { background: var(--accent); color: var(--accent-fg); }
/* dòng diễn giải: tự xuống dòng khi dài */
table.sheet tr.dgr textarea.grow { white-space: pre-wrap; word-break: break-word; }
table.sheet tr.dgr.ghost .cell.edit::placeholder { opacity: .55; }
table.sheet tr.dgr.ghost td { padding-bottom: 2px; }
/* dòng vừa thêm: nền vàng nhạt + vạch trái, giữ tới lần thêm sau */
table.sheet tr.ln.fresh td { background: var(--accent-soft); }
table.sheet tr.ln.fresh td:first-child { box-shadow: inset 4px 0 0 var(--accent); }
.pagepick { flex-wrap: wrap; gap: 6px 14px; }
.pagepick label { white-space: nowrap; }
.paper.pgbreak { margin-top: 18px; }
.paper h3.sub { font-size: 14px; margin: 14px 0 6px; }
@media print { .paper.pgbreak { break-before: page; page-break-before: always; margin-top: 0; } }
/* ảnh minh họa phụ lục */
.imgstrip { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.imgstrip .th { position: relative; display: inline-block; }
.imgstrip .th img { height: 44px; width: auto; max-width: 90px; object-fit: cover; border-radius: 4px; border: 1px solid var(--line); display: block; }
.imgstrip .th .x { position: absolute; top: -6px; right: -6px; display: none; background: var(--panel); border: 1px solid var(--line); border-radius: 50%; width: 18px; height: 18px; padding: 0; font-size: 10px; line-height: 16px; }
.imgstrip .th:hover .x { display: block; }
.imgstrip .addimg { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border: 1px dashed var(--line); border-radius: 4px; cursor: pointer; color: var(--muted); font-size: 15px; }
.imgstrip .addimg:hover { border-color: var(--accent-strong); background: var(--accent-soft); }
.imgstrip .addimg input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.paper td.pimgs img { height: 90px; width: auto; max-width: 160px; object-fit: contain; margin: 2px 4px 2px 0; vertical-align: top; }
/* bảng lương */
table.paytbl th { font-size: 11px; white-space: normal; vertical-align: bottom; }
table.paytbl td { white-space: nowrap; }
table.paytbl tfoot td { font-weight: 600; }
.lnkcell { border: 0; background: none; padding: 0; color: var(--accent-ink); cursor: pointer; font: inherit; text-decoration: underline dotted; }
/* phiếu lương */
.paper.payslip { max-width: 820px; }
.payslip .pscompany { text-align: center; font-size: 13px; }
.payslip .pscompany b { font-size: 16px; }
.payslip h2 { background: #1f3f7a; color: #fff; text-align: center; padding: 6px; margin: 14px 0 2px; }
.payslip .psdate { text-align: center; margin: 0 0 12px; color: #1f3f7a; font-weight: 600; }
.payslip .psinfo, .payslip .psmoney { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 14px; }
.payslip .psinfo table td { padding: 3px 6px; background: #eef3fb; border: 1px solid #fff; }
.payslip .psmoney thead th { background: #1f3f7a; color: #fff; }
.payslip .psmoney tfoot td { background: #fff1c7; font-weight: 700; }
.payslip .psnet { background: #eef3fb; padding: 6px 8px; display: grid; gap: 4px; margin-bottom: 18px; }
.payslip .pssign { display: grid; grid-template-columns: 1fr 1fr; text-align: center; min-height: 110px; }
@media (max-width: 700px) { .payslip .psinfo, .payslip .psmoney { grid-template-columns: 1fr; } }
@media print { .payslip h2, .payslip .psmoney thead th { -webkit-print-color-adjust: exact; print-color-adjust: exact; } }
.warnc { color: var(--warn); font-weight: 600; }
/* chấm công: ngày lễ, phép chờ duyệt, popup */
.cal-d.hol, table.att .hol { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--line) 75%, transparent) 0 6px, color-mix(in srgb, var(--line) 45%, transparent) 6px 12px) !important; }
.cal-d.hol .dn small { color: var(--fg); font-weight: 600; }
.legend-hol { display: inline-block; width: 18px; height: 14px; border-radius: 3px; background: repeating-linear-gradient(135deg, var(--line) 0 4px, color-mix(in srgb, var(--line) 50%, transparent) 4px 8px); }
.mk.pend { background: transparent !important; color: #8a1f55; box-shadow: 0 0 0 1.5px #d06a9d inset; }
.cal-d.pend { box-shadow: 0 0 0 2px #e8a5c6 inset; }
table.att td.d.pend { box-shadow: inset 0 0 0 2px #e8a5c6; }
.modal .box.daypop { width: 620px; }
.daypop .mhead .pill.hol { margin-left: 8px; }
.dprows { display: grid; gap: 8px; }
.dprow { display: grid; grid-template-columns: 70px 170px 1fr; align-items: center; gap: 8px; }
.dprow .dpl { font-weight: 600; }
.dprow .dpl small { display: block; font-weight: 400; color: var(--muted); font-size: 11px; }
.dprow .dpcur { font-size: 13px; }
.dpleave { margin-top: 12px; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); }
.dpleave.st-0 { border-color: #e8a5c6; background: color-mix(in srgb, #f7d6e6 35%, transparent); }
.dpleave.st-1 { border-color: var(--ok); }
.leaveform .field label.w90 { width: 70px; }
.lst { font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 10px; background: var(--line-soft); }
.lst.st-0 { background: #fde3c8; color: #8a4500; }
.lst.st-1 { background: var(--ok-bg); color: var(--ok); }
.lst.st-2 { background: var(--bad-bg); color: var(--bad); }
.mods .badge, .bell .badge { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px; border-radius: 9px; background: var(--bad); color: #fff; font-size: 11px; line-height: 18px; text-align: center; font-weight: 700; }
.bell { position: relative; }
.bell > button { border: 0; background: none; cursor: pointer; font-size: 17px; padding: 2px 4px; color: var(--fg); }
.bell .badge { position: absolute; top: -4px; right: -6px; margin: 0; }
.bell .drop { position: absolute; right: 0; top: 30px; z-index: 40; width: 340px; max-height: 420px; overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,.18); }
.bell .drop a { display: block; padding: 8px 12px; border-bottom: 1px solid var(--line-soft); color: inherit; text-decoration: none; font-size: 13px; }
.bell .drop a:hover { background: var(--accent-soft); }
.bell .drop a.unread { background: color-mix(in srgb, var(--accent-soft) 60%, transparent); }
.bell .drop a b { display: block; }
.bell .drop small { color: var(--muted); }
.bell .drop .empty { padding: 12px; }
.leavecalc { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; display: grid; gap: 3px; background: var(--sunk); }
.leavecalc > div { display: flex; justify-content: space-between; }
.dplock { margin: 0 0 10px; padding: 6px 10px; border-radius: 6px; background: var(--warn-bg); color: var(--warn); font-size: 13px; }
td.pubcell { white-space: nowrap; }
td.pubcell .btn { margin-left: 3px; }
.btn.pubon { color: var(--ok); border-color: var(--ok); }
.tplbar { display: inline-flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.tplbar select { width: auto; max-width: 260px; }
.tplpanel { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 6px 0; padding: 8px 10px; border: 1px dashed var(--line); border-radius: 8px; background: var(--sunk); }
.tplpanel table.mini { width: 100%; }
.pwbox { position: relative; display: inline-flex; align-items: center; }
.pwbox input { width: 100%; padding-right: 30px; }
.pwbox .eye { position: absolute; right: 4px; border: 0; background: none; color: var(--muted); cursor: pointer; padding: 3px; display: flex; }
.pwbox .eye:hover { color: var(--fg); }
