/* FlowBiz landing — demo theatre + bản sao tĩnh các thành phần giao diện của ứng dụng FlowBiz
   (header điều hướng, thanh app, CountChips, danh sách nâng cao, DealKanbanCard, DealRank,
   TaskPriorityPill, KpiCard, widget trang chủ, báo cáo ngày, bảng thông báo). */

/* ---------- avatars / badges dùng chung (InitialsAvatar, DealRank) ---------- */
.av { width: 22px; height: 22px; border-radius: 50%; display: inline-grid; place-items: center; flex: none; font-size: 11px; font-weight: 500; line-height: 1; user-select: none; }
.av.md { width: 28px; height: 28px; font-size: 12px; }
.av.lg { width: 36px; height: 36px; font-size: 14px; }
.av.sq { border-radius: 7px; }
.t0 { background: var(--blue-bg); color: var(--blue-fg); } .t1 { background: var(--green-bg); color: var(--green-fg); }
.t2 { background: var(--amber-bg); color: var(--amber-fg); } .t3 { background: var(--violet-bg); color: var(--violet-fg); }
.t4 { background: var(--pink-bg); color: var(--pink-fg); } .t5 { background: var(--teal-bg); color: var(--teal-fg); }
.t6 { background: var(--orange-bg); color: var(--orange-fg); } .t7 { background: var(--cyan-bg); color: var(--cyan-fg); }
.rank { display: inline-flex; align-items: center; gap: 4px; padding: 1px 6px; border-radius: 4px; font-size: 11px; font-weight: 600; line-height: 16px; flex: none; }
.rank i { font-style: normal; font-weight: 400; opacity: .7; }
.r-a { background: #dcfce7; color: #166534; } .r-b { background: #fef3c7; color: #92400e; } .r-c { background: #f3f4f6; color: #374151; }
:root[data-theme="dark"] .r-a { background: rgba(20, 83, 45, .4); color: #86efac; } :root[data-theme="dark"] .r-b { background: rgba(120, 53, 15, .4); color: #fcd34d; } :root[data-theme="dark"] .r-c { background: #1f2937; color: #d1d5db; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .r-a { background: rgba(20, 83, 45, .4); color: #86efac; } :root:not([data-theme="light"]) .r-b { background: rgba(120, 53, 15, .4); color: #fcd34d; } :root:not([data-theme="light"]) .r-c { background: #1f2937; color: #d1d5db; } }

/* ---------- agent panel pieces (dùng cả ở hero) ---------- */
.ag-h { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--surface); flex: none; }
.ag-h > div { min-width: 0; }
.ag-h b { display: block; font-size: 13.5px; font-weight: 600; }
.ag-h small { display: block; color: var(--muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ag-av { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: linear-gradient(135deg, #3a6ff0, #7c3aed); color: #fff; flex: none; }
.ag-av svg { width: 18px; height: 18px; }
.ag-av.sm { width: 28px; height: 28px; border-radius: 8px; }
.ag-av.sm svg { width: 15px; height: 15px; }
.live { margin-left: auto; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); flex: none; }
.ag-me { justify-self: end; margin-left: auto; max-width: 92%; background: var(--primary); color: var(--primary-ink); border-radius: 12px 12px 4px 12px; padding: 8px 11px; font-weight: 500; font-size: 12.5px; line-height: 1.45; }
.ag-appr { border: 1px solid var(--border); border-left: 3px solid #f5a524; border-radius: 12px; background: var(--surface); padding: 10px 12px; }
.ag-appr p { margin: 6px 0 10px; }
.ap-h { display: flex; align-items: center; gap: 8px; }
.wait { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 500; color: var(--amber-fg); background: var(--amber-bg); padding: 2px 8px; border-radius: 999px; }
.wait i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.ap-btns { display: flex; justify-content: flex-end; gap: 6px; flex-wrap: wrap; }
.ap-btns .b { font-size: 12px; font-weight: 500; padding: 5px 10px; border-radius: 8px; border: 1px solid var(--border-2); background: var(--surface); color: var(--text); white-space: nowrap; }
.ap-btns .b.ok { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
@media (prefers-reduced-motion: no-preference) { .live, .wait i { animation: pulse 2s ease-in-out infinite; } }

/* ---------- theatre ---------- */
.demo-sec { padding-top: 72px; }
.th { position: relative; }
.th-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-bottom: 10px; }
.th-tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px; margin: -2px; max-width: 100%; }
.th-tabs::-webkit-scrollbar { display: none; }
.th-tabs button { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--border-2); background: var(--surface); color: var(--text-2); font: inherit; font-size: 14px; cursor: pointer; white-space: nowrap; }
.th-tabs button:hover { background: var(--surface-2); }
.th-tabs button[aria-pressed="true"] { border-color: color-mix(in srgb, var(--primary) 40%, transparent); background: var(--blue-bg); color: var(--primary); font-weight: 500; }
.dd { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.d-sales { background: #e5483d; } .d-hr { background: #2f6fe4; } .d-finance { background: #22a06b; } .d-ops { background: #f08c2b; } .d-mgmt { background: #7c5cdb; }
.th-ctl { display: flex; align-items: center; gap: 6px; }
.th-count { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 48px; text-align: right; margin-right: 2px; }
.ib { width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: 9px; border: 1px solid var(--border-2); background: var(--surface); color: var(--text); cursor: pointer; }
.ib:hover { border-color: var(--primary); color: var(--primary); }
.ib svg.i { width: 16px; height: 16px; }
#thPlay .i-play { display: none; }
#thPlay[aria-pressed="false"] .i-play { display: block; }
#thPlay[aria-pressed="false"] .i-pause { display: none; }
#thPlay .i-play, #thPlay .i-pause { fill: currentColor; stroke: none; }
.th-list { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: thin; padding: 4px 2px 8px; margin: 0 -2px 6px; }
.th-list button { display: inline-flex; align-items: center; gap: 7px; flex: none; max-width: 280px; height: 30px; padding: 0 12px; border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; white-space: nowrap; }
.th-list button span { overflow: hidden; text-overflow: ellipsis; }
.th-list button:hover { color: var(--text); background: var(--surface); border-color: var(--border); }
.th-list button[aria-current="true"] { color: var(--text); background: var(--surface); border-color: var(--border-2); box-shadow: var(--shadow); font-weight: 500; }

/* story: pain → use case → value */
.th-story { display: grid; gap: 12px; margin-bottom: 14px; }
@media (min-width: 1024px) { .th-story { grid-template-columns: 1fr 1.15fr 1fr; } }
.sto { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.sto-k { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
html:lang(ja) .sto-k { letter-spacing: .02em; }
.sto-k .tile { width: 24px; height: 24px; border-radius: 7px; }
.sto-k .tile svg.i { width: 14px; height: 14px; }
.sto-k .dept { margin-left: auto; text-transform: none; letter-spacing: 0; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); }
.sto p { margin: 0; font-size: 14.5px; color: var(--text-2); line-height: 1.55; }
.sto-stat { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; }
.sto-stat b { font-size: 24px; font-weight: 600; letter-spacing: -.01em; color: var(--red-fg); font-variant-numeric: tabular-nums; }
.sto-stat span { font-size: 13px; color: var(--muted); }
.sto-who { display: flex; align-items: center; gap: 10px; }
.sto-who b { display: block; font-size: 14.5px; font-weight: 600; }
.sto-who small { display: block; font-size: 12.5px; color: var(--muted); }
.sto-ask { display: flex; gap: 8px; padding: 10px 12px; border-radius: 12px 12px 12px 4px; background: var(--surface-2); border: 1px dashed var(--border-2); font-size: 14px; font-weight: 500; color: var(--text); line-height: 1.5; }
.sto-ask svg.i { width: 16px; height: 16px; color: var(--primary); margin-top: 3px; }
.sto-out { transition: border-color .3s ease, box-shadow .3s ease; }
.sto-out .sto-body { transition: opacity .4s ease; opacity: .45; }
.sto-out.lit { border-color: color-mix(in srgb, var(--ok) 55%, transparent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 14%, transparent); }
.sto-out.lit .sto-body { opacity: 1; }
.sto-out .sto-body p { font-weight: 500; color: var(--text); }
.sto-mets { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.sto-mets div { border-radius: 10px; background: var(--green-bg); padding: 8px 10px; min-width: 0; }
.sto-mets b { display: block; font-size: 18px; font-weight: 600; color: var(--green-fg); line-height: 1.25; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.sto-mets small { display: block; font-size: 12px; color: var(--text-2); line-height: 1.35; }
.sto-wait { font-size: 12px; color: var(--muted); }
.sto-out.lit .sto-wait { display: none; }

/* phases */
.th-phases { list-style: none; margin: 0 0 12px; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.th-phases li { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); color: var(--muted); font-size: 13px; min-width: 0; transition: background .25s ease, color .25s ease, border-color .25s ease; }
.th-phases li span { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); font-size: 12px; font-weight: 600; flex: none; }
.th-phases li b { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.th-phases li.on { color: var(--text); border-color: color-mix(in srgb, var(--primary) 45%, transparent); background: var(--blue-bg); }
.th-phases li.on span { background: var(--primary); color: var(--primary-ink); }
.th-phases li.ok { color: var(--text-2); }
.th-phases li.ok span { background: var(--green-bg); color: var(--green-fg); }
.th-phases li[data-ph="3"].on { background: var(--amber-bg); border-color: color-mix(in srgb, #f5a524 50%, transparent); }
.th-phases li[data-ph="3"].on span { background: #f5a524; color: #fff; }
@media (max-width: 640px) { .th-phases { grid-template-columns: 1fr 1fr; } .th-phases li { padding: 6px 8px; font-size: 12.5px; } }
.th-note { margin: 10px 0 0; font-size: 12.5px; color: var(--muted); text-align: center; }

/* ---------- app frame ---------- */
.fx { --fx-h: 620px; position: relative; display: flex; flex-direction: column; height: var(--fx-h); border-radius: 16px; overflow: hidden; border: 1px solid var(--border-2); background: var(--bg); box-shadow: 0 30px 60px -30px rgba(18, 27, 52, .35), var(--shadow); font-size: 13px; line-height: 1.4; color: var(--text); }
.fx-head { flex: none; height: 52px; display: flex; align-items: center; gap: 12px; padding: 0 12px 0 10px; background: #16213e; background-image: var(--navy-grad); color: #e8edf7; border-bottom: 1px solid #0f1830; }
.fx-brand { display: flex; align-items: center; gap: 9px; min-width: 0; width: 210px; flex: none; }
.fx-brand b { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fx-logo { width: 36px; height: 30px; display: grid; place-items: center; flex: none; }
.fx-logo svg { width: 36px; height: 30px; }
.fx-search { flex: 1 1 auto; min-width: 0; max-width: 460px; margin: 0 auto; height: 32px; display: flex; align-items: center; gap: 8px; padding: 0 8px 0 10px; border-radius: 8px; background: rgba(255, 255, 255, .1); color: rgba(232, 237, 247, .75); font-size: 13px; }
.fx-search span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fx-search svg.i { width: 15px; height: 15px; }
.fx-search kbd { font: inherit; font-size: 11px; height: 20px; padding: 0 6px; display: inline-flex; align-items: center; border-radius: 4px; background: rgba(255, 255, 255, .1); }
.fx-right { display: flex; align-items: center; gap: 6px; flex: none; }
.fx-remind { height: 28px; display: inline-flex; align-items: center; gap: 6px; padding: 0 12px 0 9px; border-radius: 14px; background: #fff; color: #1f4fd8; font-size: 13px; font-weight: 500; white-space: nowrap; }
.fx-remind svg.i { width: 14px; height: 14px; }
.fx-btn { position: relative; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; }
.fx-btn svg.i { width: 18px; height: 18px; }
.fx-badge { position: absolute; top: 0; right: -3px; min-width: 17px; height: 17px; padding: 0 4px; border: 2px solid #16213e; border-radius: 9px; background: #f04438; color: #fff; font-size: 9.5px; font-weight: 700; line-height: 13px; text-align: center; }
.fx-badge.bump { animation: bump .5s ease; }
.fx-me { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: #e3ebff; color: #1f4fd8; font-size: 12px; font-weight: 600; flex: none; }
.fx-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 68px minmax(0, 1fr) 352px; }
.fx-rail { display: flex; flex-direction: column; gap: 2px; padding: 8px 4px; background: var(--surface); border-right: 1px solid var(--border); overflow: hidden; }
.ri { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 2px; border-radius: 10px; color: var(--muted); }
.ri .ms { width: 28px; height: 28px; }
.ri small { font-size: 10px; line-height: 1.2; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ri.on { background: var(--blue-bg); color: var(--text); }
.ri-ag { margin-top: auto; }
.ms-ag { background: linear-gradient(135deg, #3a6ff0, #7c3aed); }
.fx-main { min-width: 0; min-height: 0; overflow: auto; padding: 14px 16px 18px; container-type: inline-size; scrollbar-width: thin; }
.fx-agent { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--surface-2); border-left: 1px solid var(--border); }
.ag-log { flex: 1; min-height: 0; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; scrollbar-width: thin; }
.ag-in { flex: none; display: flex; align-items: center; gap: 8px; margin: 0 12px 12px; padding: 7px 7px 7px 12px; min-height: 40px; border: 1px solid var(--border-2); border-radius: 12px; background: var(--surface); color: var(--muted); font-size: 12.5px; }
.ag-in-t { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ag-in-t.typing { color: var(--text); }
.ag-in-t.typing::after { content: ""; display: inline-block; width: 1px; height: 14px; margin-left: 1px; vertical-align: -2px; background: currentColor; animation: pulse 1s steps(1) infinite; }
.send { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--primary); color: var(--primary-ink); flex: none; }
.send svg.i { width: 14px; height: 14px; }
@media (max-width: 1180px) { .fx-body { grid-template-columns: 64px minmax(0, 1fr) 312px; } .fx-brand { width: auto; } }
@media (max-width: 899px) {
  .fx { --fx-h: auto; }
  .fx-body { grid-template-columns: minmax(0, 1fr); }
  .fx-rail { display: none; }
  .fx-main { height: 400px; }
  .fx-agent { height: 470px; border-left: 0; border-top: 1px solid var(--border); }
  .fx-search { display: none; }
  .fx-brand { flex: 1; }
}
@media (max-width: 420px) { .fx-remind span { display: none; } .fx-remind { padding: 0 8px; } .fx-main { padding: 12px; } }

/* page head + count chips */
.pg-crumb { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); }
.pg-crumb i { font-style: normal; color: var(--faint); }
.pg-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 2px 0 10px; }
.pg-title h4 { margin: 0; font-size: 17px; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pg-act { display: flex; gap: 6px; flex: none; }
.pg-act span { height: 28px; display: inline-flex; align-items: center; gap: 5px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--border-2); background: var(--surface); font-size: 12.5px; color: var(--text-2); }
.pg-act span.pri { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.pg-act svg.i { width: 14px; height: 14px; }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 1px 0 10px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; flex: none; padding: 0 10px; border-radius: 999px; border: 1px solid var(--border-2); background: var(--surface); color: var(--text-2); font-size: 13px; white-space: nowrap; }
.chip.on { border-color: color-mix(in srgb, var(--primary) 40%, transparent); background: var(--blue-bg); color: var(--primary); font-weight: 500; }
.chip em { font-style: normal; font-size: 11.5px; line-height: 16px; padding: 0 6px; border-radius: 999px; background: var(--surface-3); color: var(--muted); font-variant-numeric: tabular-nums; }
.chip.on em { background: color-mix(in srgb, var(--primary) 14%, transparent); color: inherit; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--faint); }
.dot.blue { background: #3b82f6; } .dot.green { background: #22c55e; } .dot.amber { background: #f59e0b; } .dot.red { background: #ef4444; } .dot.violet { background: #8b5cf6; } .dot.gray { background: #9ca3af; }

/* enhanced list */
.fl { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); overflow: hidden; }
.fl-hd, .fl-row { display: grid; grid-template-columns: var(--cols); column-gap: 12px; align-items: center; padding: 0 12px; }
.fl-hd { height: 32px; background: var(--surface-2); color: var(--muted); font-size: 12px; border-bottom: 1px solid var(--border); }
.fl-hd span, .fl-c { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fl-hd .r, .fl-c.r { text-align: right; justify-self: end; }
.fl-row { position: relative; min-height: 48px; padding-top: 7px; padding-bottom: 7px; border-bottom: 1px solid var(--border); transition: background .3s ease, box-shadow .3s ease; }
.fl-row:last-child { border-bottom: 0; }
.fl-nm { display: flex; align-items: center; gap: 9px; min-width: 0; }
.fl-nm > div { min-width: 0; }
.fl-nm b { display: block; font-weight: 500; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fl-nm small { display: block; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ic-sq { width: 28px; height: 28px; border-radius: 7px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); flex: none; }
.ic-sq svg { width: 16px; height: 16px; }
.fl-row.mk-red { background: color-mix(in srgb, var(--red-bg) 55%, transparent); box-shadow: inset 3px 0 0 #ef4444; }
.fl-row.mk-amber { background: color-mix(in srgb, var(--amber-bg) 55%, transparent); box-shadow: inset 3px 0 0 #f59e0b; }
.fl-row.upd { background: color-mix(in srgb, var(--green-bg) 55%, transparent); box-shadow: inset 3px 0 0 #22c55e; }
.fl-note { grid-column: 1 / -1; display: none; align-items: center; gap: 6px; margin-top: 5px; font-size: 12px; font-weight: 500; min-width: 0; }
.fl-note span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fl-note svg.i { width: 13px; height: 13px; }
.mk-red > .fl-note.n-red, .mk-amber > .fl-note.n-amber, .upd > .fl-note.n-ok, .keep > .fl-note { display: flex; }
.n-red { color: var(--red-fg); } .n-amber { color: var(--amber-fg); } .n-ok { color: var(--green-fg); }
.sc { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 500; overflow: hidden; }
.sc span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc .dot { width: 6px; height: 6px; }
.sc.blue { background: var(--blue-bg); color: var(--blue-fg); } .sc.green { background: var(--green-bg); color: var(--green-fg); }
.sc.amber { background: var(--amber-bg); color: var(--amber-fg); } .sc.red { background: var(--red-bg); color: var(--red-fg); }
.sc.violet { background: var(--violet-bg); color: var(--violet-fg); } .sc.gray { background: var(--gray-bg); color: var(--gray-fg); }
.pp { display: inline-flex; align-items: center; gap: 4px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 500; line-height: 20px; }
.pp svg.i { width: 12px; height: 12px; }
.pp.high { background: var(--red-bg); color: var(--red-fg); } .pp.med { background: var(--amber-bg); color: var(--amber-fg); } .pp.low { background: var(--gray-bg); color: var(--gray-fg); }
.dt { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 12.5px; min-width: 0; }
.dt svg.i { width: 13px; height: 13px; }
.dt.late { color: var(--red-fg); }
.dt span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mn { font-variant-numeric: tabular-nums; font-weight: 500; }
.num { font-variant-numeric: tabular-nums; }
.num.red { color: var(--red-fg); font-weight: 600; } .num.amber { color: var(--amber-fg); font-weight: 600; }
.br { display: flex; align-items: center; gap: 8px; min-width: 0; }
.br i { flex: 1; min-width: 36px; height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.br i b { display: block; height: 100%; border-radius: inherit; transition: width .6s ease; }
.br span { font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--text-2); }
.bg-green { background: #22c55e; } .bg-amber { background: #f59e0b; } .bg-red { background: #ef4444; } .bg-blue { background: #3b82f6; } .bg-violet { background: #8b5cf6; }
@container (max-width: 520px) {
  .fl-hd, .fl-row { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) !important; }
  .fl-hd > :not(:first-child):not(.m), .fl-row > .fl-c:not(:first-child):not(.m) { display: none; }
  .fl-hd > .m, .fl-row > .fl-c.m { text-align: right; justify-self: end; }
  .pg-act span:not(.pri) { display: none; }
}

/* kanban (DealPipelineSummary + DealKanbanCard) */
.ps { display: grid; grid-template-columns: 44px repeat(4, minmax(0, 1fr)); gap: 6px; margin-bottom: 12px; }
.ps-cur { display: grid; place-items: center; border-radius: 7px; background: var(--surface-3); font-size: 12px; font-weight: 500; color: var(--text-2); }
.ps-c { border: 1px solid var(--border); border-radius: 7px; background: var(--surface); padding: 5px 10px; min-width: 0; }
.ps-c small { display: block; font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ps-c b { font-size: 14px; font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ps-c b.red { color: var(--red-fg); }
.ps-c em { font-style: normal; font-size: 11.5px; color: var(--muted); margin-left: 4px; }
.kb { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(196px, 1fr); gap: 10px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }
.kb-col { background: var(--surface-2); border-radius: 12px; padding: 8px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.kb-h { display: flex; align-items: center; gap: 7px; padding: 2px 4px; font-size: 13px; font-weight: 500; }
.kb-h em { font-style: normal; margin-left: auto; color: var(--muted); font-size: 12px; }
.kc2 { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); box-shadow: 0 1px 2px rgba(16, 24, 40, .05); transition: box-shadow .3s ease, border-color .3s ease; }
.kc2-t { display: flex; align-items: flex-start; gap: 8px; min-width: 0; }
.kc2-t > div { flex: 1; min-width: 0; }
.kc2-t b { display: block; font-size: 13.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kc2-t small { display: block; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kc2-w { width: 20px; height: 20px; border-radius: 50%; display: none; place-items: center; flex: none; }
.kc2-w svg.i { width: 13px; height: 13px; }
.kc2.mk-red .kc2-w { display: grid; background: var(--red-bg); color: var(--red-fg); }
.kc2.mk-amber .kc2-w { display: grid; background: var(--amber-bg); color: var(--amber-fg); }
.kc2-r { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.kc2-v { font-size: 13.5px; font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kc2.mk-red { border-color: color-mix(in srgb, #ef4444 55%, transparent); box-shadow: 0 0 0 3px color-mix(in srgb, #ef4444 14%, transparent); }
.kc2.mk-amber { border-color: color-mix(in srgb, #f59e0b 60%, transparent); box-shadow: 0 0 0 3px color-mix(in srgb, #f59e0b 14%, transparent); }
.kc2.upd { border-color: color-mix(in srgb, #22c55e 55%, transparent); box-shadow: 0 0 0 3px color-mix(in srgb, #22c55e 14%, transparent); }
.kc2 .fl-note { margin-top: 0; }
.kc2 .fl-note span { white-space: normal; }

/* dashboard (KpiCard + widgets trang chủ) */
.kp { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-bottom: 12px; }
.kpc { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); min-width: 0; transition: box-shadow .3s ease; }
.kpc .tile { width: 40px; height: 40px; border-radius: 10px; }
.kpc .tile svg { width: 20px; height: 20px; }
.kpc > div { min-width: 0; }
.kpc small { display: block; font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kpc strong { font-size: 22px; font-weight: 600; line-height: 1.3; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dl { display: inline-flex; align-items: center; margin-left: 6px; padding: 1px 6px; border-radius: 999px; font-size: 11.5px; font-weight: 500; vertical-align: 3px; white-space: nowrap; }
.dl.good { background: var(--green-bg); color: var(--green-fg); } .dl.bad { background: var(--red-bg); color: var(--red-fg); } .dl.flat { background: var(--gray-bg); color: var(--gray-fg); }
.kpc.upd { box-shadow: 0 0 0 3px color-mix(in srgb, #22c55e 18%, transparent); border-color: color-mix(in srgb, #22c55e 50%, transparent); }
.wg-grid { display: grid; gap: 10px; }
@container (min-width: 560px) { .wg-grid { grid-template-columns: 1fr 1fr; } }
.wg { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); padding: 12px 14px; min-width: 0; }
.wg h5 { margin: 0 0 10px; font-size: 12px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
html:lang(ja) .wg h5 { text-transform: none; letter-spacing: 0; }
.wb { display: grid; grid-template-columns: minmax(64px, .8fr) minmax(0, 2fr); align-items: center; gap: 4px 10px; padding: 5px 6px; margin: 0 -6px; border-radius: 8px; font-size: 12.5px; transition: background .3s ease; }
.wb > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.wb.mk-red, .wb.mk-amber { background: color-mix(in srgb, var(--red-bg) 60%, transparent); }
.wb.mk-amber { background: color-mix(in srgb, var(--amber-bg) 60%, transparent); }
.wl { margin: 0 -6px; }
.wl .fl-row { grid-template-columns: minmax(0, 1fr) auto; padding: 7px 6px; border-radius: 8px; border-bottom: 0; min-height: 0; }
.wl .fl-row + .fl-row { border-top: 1px solid var(--border); }

/* daily report */
.rp { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); padding: 16px 18px; }
.rp-h { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.rp-h h5 { margin: 0; font-size: 15px; font-weight: 600; }
.rp-h small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.rp-k { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 14px 0; }
.rp-k div { border-radius: 10px; background: var(--surface-2); padding: 8px 10px; min-width: 0; }
.rp-k small { display: block; font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rp-k b { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rp-k .dl { vertical-align: 1px; margin-left: 4px; }
.rp-s { padding: 10px 0 2px; border-top: 1px solid var(--border); }
.rp-s h6 { display: flex; align-items: center; gap: 7px; margin: 0 0 6px; font-size: 13px; font-weight: 600; }
.rp-s ul { margin: 0; padding: 0 0 0 18px; display: grid; gap: 4px; font-size: 13px; color: var(--text-2); }
.rp-sk { display: grid; gap: 6px; padding: 4px 0 8px; }
.rp-sk i { display: block; height: 9px; border-radius: 5px; background: var(--surface-3); }
.rp-sk i:nth-child(2) { width: 78%; } .rp-sk i:nth-child(3) { width: 56%; }
@media (prefers-reduced-motion: no-preference) { .rp-sk i { animation: pulse 1.6s ease-in-out infinite; } .rp-s.in { animation: fade .45s ease both; } }
@container (max-width: 520px) { .rp-k { grid-template-columns: 1fr 1fr; } .rp-k div:nth-child(3) { display: none; } }

/* leave calendar */
.gt { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); overflow: hidden; }
.gt-r { display: grid; grid-template-columns: minmax(120px, 1.3fr) minmax(0, 3fr); align-items: center; border-bottom: 1px solid var(--border); min-height: 46px; transition: background .3s ease, box-shadow .3s ease; }
.gt-r:last-child { border-bottom: 0; }
.gt-r > .fl-nm { padding: 6px 10px; }
.gt-r > .fl-note { padding: 0 10px 6px; margin: 0; }
.gt-hd { min-height: 30px; background: var(--surface-2); font-size: 12px; color: var(--muted); }
.gt-tr { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); height: 100%; align-items: center; position: relative; padding: 0 4px; }
.gt-tr > span { text-align: center; font-size: 12px; }
.gt-bar { height: 20px; border-radius: 6px; margin: 0 2px; transition: background .3s ease; }
.gt-bar.violet { background: color-mix(in srgb, #8b5cf6 30%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, #8b5cf6 60%, transparent); }
.gt-bar.green { background: color-mix(in srgb, #22c55e 30%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, #22c55e 60%, transparent); }
.gt-bar.amber { background: color-mix(in srgb, #f59e0b 30%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, #f59e0b 60%, transparent); }
.gt-r.mk-red { background: color-mix(in srgb, var(--red-bg) 55%, transparent); box-shadow: inset 3px 0 0 #ef4444; }
.gt-r.mk-amber { background: color-mix(in srgb, var(--amber-bg) 55%, transparent); box-shadow: inset 3px 0 0 #f59e0b; }
.gt-r.upd { background: color-mix(in srgb, var(--green-bg) 55%, transparent); box-shadow: inset 3px 0 0 #22c55e; }
.gt-cov { background: var(--surface-2); font-size: 12px; }
.gt-cov .gt-tr > span { margin: 0 2px; border-radius: 6px; padding: 3px 0; font-weight: 600; font-variant-numeric: tabular-nums; background: var(--green-bg); color: var(--green-fg); }
.gt-cov .gt-tr > span.low { background: var(--red-bg); color: var(--red-fg); }
.gt-cov .lbl { padding: 6px 10px; color: var(--muted); }

/* agent log entries */
.ag-log > * { flex: none; }
.ag-tool { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); overflow: hidden; }
.ag-tool-h { display: flex; align-items: center; gap: 8px; padding: 8px 10px; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--border); }
.ag-tool-h b { font-weight: 500; color: var(--text-2); }
.ag-tool-h em { margin-left: auto; font-style: normal; font-variant-numeric: tabular-nums; }
.ag-prog { height: 2px; background: var(--surface-3); }
.ag-prog i { display: block; height: 100%; width: 0; background: var(--primary); transition: width .4s ease; }
.ag-steps { list-style: none; margin: 0; padding: 6px 10px 8px; display: grid; gap: 2px; }
.st { display: flex; gap: 8px; align-items: flex-start; padding: 4px 0; font-size: 12.5px; }
.st > div { min-width: 0; }
.st b { display: block; font-weight: 400; color: var(--text); }
.st small { display: block; font-size: 11.5px; color: var(--muted); }
.st-i { width: 16px; height: 16px; flex: none; margin-top: 1px; border-radius: 50%; display: grid; place-items: center; }
.st.run .st-i { border: 2px solid color-mix(in srgb, var(--primary) 25%, transparent); border-top-color: var(--primary); animation: spin .8s linear infinite; }
.st.ok .st-i { background: var(--green-bg); color: var(--green-fg); }
.st.ok .st-i svg.i { width: 11px; height: 11px; stroke-width: 3; }
.ag-card { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); padding: 10px 12px; font-size: 12.5px; }
.ag-card > b { display: flex; gap: 8px; align-items: flex-start; font-weight: 500; font-size: 13px; margin-bottom: 6px; line-height: 1.45; }
.ag-card > b svg.i { width: 15px; height: 15px; color: var(--violet-fg); margin-top: 2px; }
.ag-card ul, .ag-appr ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ag-card li { display: flex; gap: 8px; line-height: 1.45; color: var(--text-2); }
.ag-card li::before { content: ""; width: 7px; height: 7px; border-radius: 50%; flex: none; margin-top: 6px; background: var(--faint); }
.ag-card li.red::before { background: #ef4444; } .ag-card li.amber::before { background: #f59e0b; } .ag-card li.green::before { background: #22c55e; } .ag-card li.blue::before { background: #3b82f6; }
.ag-appr { font-size: 12.5px; }
.ag-appr > b { display: block; font-weight: 500; margin: 8px 0 6px; }
.ag-appr ul { counter-reset: a; margin-bottom: 10px; }
.ag-appr li { counter-increment: a; display: flex; gap: 8px; line-height: 1.45; color: var(--text-2); }
.ag-appr li::before { content: counter(a); width: 18px; height: 18px; border-radius: 50%; background: var(--surface-3); display: grid; place-items: center; font-size: 11px; font-weight: 600; flex: none; color: var(--text-2); }
.ag-appr .ap-btns button { font: inherit; font-size: 12.5px; font-weight: 500; height: 32px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--border-2); background: var(--surface); color: var(--text); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; position: relative; overflow: hidden; }
.ag-appr .ap-btns button:hover { border-color: var(--primary); }
.ag-appr .ap-btns button.ok { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.ag-appr .ap-btns button.ok:hover { filter: brightness(1.08); }
.ag-appr .ap-btns button svg.i { width: 14px; height: 14px; }
.ag-appr .ap-btns button:disabled { cursor: default; opacity: .55; }
.ag-appr .ap-btns button.ok.cd::after { content: ""; position: absolute; left: 0; bottom: 0; height: 3px; width: var(--cd, 0%); background: rgba(255, 255, 255, .7); }
.ag-appr.done { border-left-color: #22c55e; }
.ag-appr.no { border-left-color: var(--faint); }
.ap-hint { margin: 8px 0 0; font-size: 11.5px; color: var(--muted); text-align: right; }
.wait.ok { background: var(--green-bg); color: var(--green-fg); }
.wait.no { background: var(--gray-bg); color: var(--gray-fg); }
.ag-sys { align-self: center; font-size: 11.5px; color: var(--muted); background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 2px 10px; }
.ag-done { display: flex; align-items: center; gap: 8px; border-radius: 12px; background: var(--green-bg); color: var(--green-fg); padding: 8px 10px; font-size: 12.5px; font-weight: 500; }
.ag-done.neutral { background: var(--surface); color: var(--text-2); border: 1px solid var(--border); }
.ag-done span { flex: 1; }
.ag-done button { font: inherit; font-size: 12px; border: 1px solid currentColor; background: transparent; color: inherit; border-radius: 7px; height: 26px; padding: 0 8px; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; opacity: .9; }
.ag-done button svg.i { width: 13px; height: 13px; }

/* toast (NotificationPanel item) */
.fx-toast { position: absolute; z-index: 5; top: 60px; right: 12px; width: min(320px, calc(100% - 24px)); display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px 10px 16px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); box-shadow: 0 18px 40px -14px rgba(6, 12, 32, .45); }
.fx-toast[hidden] { display: none; }
.fx-toast::before { content: ""; position: absolute; left: 6px; top: 22px; width: 6px; height: 6px; border-radius: 50%; background: var(--primary); }
.fx-toast b { display: block; font-weight: 500; font-size: 13px; line-height: 1.4; }
.fx-toast small { display: block; font-size: 11.5px; color: var(--muted); }
.fx-toast button { margin-left: auto; width: 24px; height: 24px; border: 0; background: transparent; color: var(--muted); border-radius: 6px; display: grid; place-items: center; cursor: pointer; flex: none; }
.fx-toast button:hover { background: var(--surface-2); }
.fx-toast button svg.i { width: 14px; height: 14px; }

@media (prefers-reduced-motion: no-preference) {
  .ag-log > .in { animation: fade .35s ease both; }
  .fx-toast.in { animation: toast .4s cubic-bezier(.2, .8, .2, 1) both; }
  .fl-row, .kc2, .gt-r { transition: background .35s ease, box-shadow .35s ease, border-color .35s ease; }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes toast { from { opacity: 0; transform: translateY(-10px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.35); } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .st.run .st-i { animation: none; } .ag-in-t.typing::after { animation: none; } }
