:root {
  --pri: #0f766e; --pri-d: #0b5d56; --pri-l: #d9f2ee; --bg: #eef5f4; --card: #fff; --line: #e2e8e7;
  --tx: #17211f; --mu: #66736f; --red: #c0262d; --amber: #b45309; --green: #15803d; --blue: #1d4ed8; --violet: #6d28d9;
  --r: 14px; --sh: 0 1px 2px rgba(16, 40, 36, .06), 0 2px 8px rgba(16, 40, 36, .05);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; color: var(--tx); background: var(--bg); }
a { color: var(--pri); }
h1, h2, h3, h4 { margin: 0; line-height: 1.3; }
input, select, textarea, button { font: inherit; color: inherit; }
.muted { color: var(--mu); } .small { font-size: 13px; } .block { display: block; } .pad { padding: 10px 2px; }
.c-red { color: var(--red) !important; } .c-amber { color: var(--amber) !important; } .c-green { color: var(--green) !important; } .c-violet { color: var(--violet); }

/* thanh trạng thái tải */
body::before { content: ""; position: fixed; top: 0; left: 0; height: 3px; width: 0; background: #fbbf24; z-index: 100; transition: width .3s; }
body.busy::before { width: 70%; transition: width 4s cubic-bezier(.1, .7, .2, 1); }

/* nút */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 15px; border-radius: 10px; border: 1px solid var(--line); background: #fff; cursor: pointer; text-decoration: none; color: var(--tx); font-weight: 600; font-size: 14px; white-space: nowrap; min-height: 40px; }
.btn:hover { border-color: #b9c9c6; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--pri); border-color: var(--pri); color: #fff; }
.btn.primary:hover { background: var(--pri-d); }
.btn.excel { background: #1f7a44; border-color: #1f7a44; color: #fff; }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.danger-o { color: var(--red); border-color: #f1c4c6; }
.btn.ghost { background: transparent; }
.btn.block { width: 100%; }
.link { background: none; border: 0; color: var(--pri); cursor: pointer; padding: 0; font-size: 13px; }
.icon-btn { background: transparent; border: 0; color: #fff; width: 40px; height: 40px; border-radius: 10px; font-size: 20px; cursor: pointer; position: relative; display: inline-flex; align-items: center; justify-content: center; }
.icon-btn:hover { background: rgba(255, 255, 255, .12); }
.badge { position: absolute; top: 2px; right: 0; background: #ef4444; color: #fff; font-size: 11px; font-weight: 700; border-radius: 10px; padding: 0 5px; min-width: 18px; line-height: 18px; }

/* đầu trang */
.demo-bar { background: #fef3c7; color: #78350f; font-size: 13px; text-align: center; padding: 5px 10px; }
.top { position: sticky; top: 0; z-index: 20; background: var(--pri); color: #fff; padding-top: env(safe-area-inset-top, 0px); box-shadow: 0 2px 6px rgba(0, 0, 0, .12); }
.top-in { display: flex; align-items: center; gap: 6px; max-width: 1200px; margin: 0 auto; padding: 8px 10px; }
.top .logo { width: 34px; height: 34px; border-radius: 9px; background: #fff; }
.top-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top-title small { opacity: .8; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-title b { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#backBtn { font-size: 30px; }

/* bố cục */
.layout { max-width: 1200px; margin: 0 auto; display: flex; gap: 18px; }
main { flex: 1; min-width: 0; padding: 12px 12px calc(84px + var(--safe-b)); }
.side { display: none; }
.bottom { position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; display: flex; background: #fff; border-top: 1px solid var(--line); padding-bottom: var(--safe-b); }
.bottom a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 7px 0 6px; text-decoration: none; color: var(--mu); font-size: 11px; position: relative; }
.bottom a i { font-style: normal; display: flex; align-items: center; justify-content: center; height: 26px; }
.bottom a i svg, .side a i svg { width: 22px; height: 22px; }
.bottom a.on { color: var(--pri); font-weight: 700; }
.bottom a.fab i { background: var(--pri); color: #fff; width: 46px; height: 46px; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin-top: -18px; box-shadow: 0 3px 10px rgba(15, 118, 110, .4); }
.bottom a em { position: absolute; top: 3px; left: 54%; background: #ef4444; color: #fff; font-style: normal; font-size: 10px; border-radius: 9px; padding: 0 5px; line-height: 16px; }
@media (min-width: 900px) {
  .side { display: block; width: 230px; flex-shrink: 0; padding: 16px 0; position: sticky; top: 56px; align-self: flex-start; }
  .side a { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 10px; color: var(--tx); text-decoration: none; font-weight: 500; }
  .side a i { font-style: normal; width: 22px; display: flex; color: var(--mu); }
  .side a.on i { color: var(--pri); }
  .side a:hover { background: #fff; }
  .side a.on { background: var(--pri-l); color: var(--pri-d); font-weight: 700; }
  .side a .pill { margin-left: auto; background: var(--violet); color: #fff; font-size: 12px; border-radius: 10px; padding: 0 7px; }
  .side-user { display: flex; gap: 10px; align-items: center; padding: 6px 12px 16px; }
  .side-user small { display: block; color: var(--mu); font-size: 12px; }
  .bottom { display: none; }
  main { padding: 18px 16px 40px; }
}

/* thẻ */
.card { background: var(--card); border-radius: var(--r); box-shadow: var(--sh); padding: 14px; margin-bottom: 12px; }
.card h3 { font-size: 16px; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.card h4 { font-size: 14px; margin: 12px 0 4px; }
.card h4.sub { color: var(--mu); font-weight: 600; font-size: 13px; margin: 8px 0 2px; }
.count { background: #eef2f1; color: var(--mu); font-size: 12px; border-radius: 10px; padding: 0 8px; }
.grid2 { display: grid; gap: 0 12px; }
@media (min-width: 760px) { .grid2 { grid-template-columns: 1fr 1fr; } }
.hello { padding: 4px 2px 12px; } .hello h2 { font-size: 20px; } .hello p { margin: 2px 0 0; color: var(--mu); }

/* ô số liệu */
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 12px; }
@media (min-width: 640px) { .tiles { grid-template-columns: repeat(5, 1fr); } }
.tile { background: #fff; border-radius: var(--r); padding: 12px; text-decoration: none; color: var(--tx); box-shadow: var(--sh); border-left: 4px solid; display: flex; flex-direction: column; }
.tile b { font-size: 26px; line-height: 1.1; }
.tile span { font-size: 13px; color: var(--mu); }
.t-blue { border-color: var(--blue); } .t-blue b { color: var(--blue); }
.t-amber { border-color: #f59e0b; } .t-amber b { color: var(--amber); }
.t-red { border-color: var(--red); } .t-red b { color: var(--red); }
.t-violet { border-color: var(--violet); } .t-violet b { color: var(--violet); }
.t-green { border-color: var(--green); } .t-green b { color: var(--green); }
.tiles .tile:last-child:nth-child(odd) { grid-column: span 2; }
@media (min-width: 640px) { .tiles .tile:last-child:nth-child(odd) { grid-column: auto; } }

/* danh sách ngắn */
.mlist { display: flex; flex-direction: column; }
.mi { display: flex; gap: 10px; justify-content: space-between; align-items: flex-start; padding: 9px 4px; border-top: 1px solid var(--line); text-decoration: none; color: var(--tx); }
.mi:first-child { border-top: 0; }
.mi b { font-weight: 600; display: block; color: var(--pri-d); }
.mi small { color: var(--mu); font-size: 12.5px; }
.mi.late b { color: var(--red); }
.mi-r { flex-shrink: 0; text-align: right; }

/* nhãn trạng thái */
.st { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px; white-space: nowrap; color: #fff; }
.st-wait { background: var(--violet); } .st-rej { background: #9f1239; } .st-new { background: #6b7280; } .st-doing { background: var(--blue); }
.st-review { background: #7c3aed; } .st-done { background: var(--green); } .st-cancel { background: #9ca3af; }
.st-late { background: #fee2e2; color: var(--red); } .st-soon { background: #fef3c7; color: var(--amber); }
.prio { font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 6px; background: #f1f5f4; color: var(--mu); }
.prio.p2 { background: #ffedd5; color: #c2410c; } .prio.p3 { background: #fee2e2; color: var(--red); }
.rating { display: inline-block; font-weight: 700; font-size: 12.5px; padding: 2px 9px; border-radius: 999px; color: #fff; }
.rA { background: #047857; } .rB { background: #2563eb; } .rC { background: #d97706; } .rD { background: #b91c1c; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.code { font-family: ui-monospace, Menlo, Consolas, monospace; color: var(--mu); font-size: 12px; }

/* thanh tiến độ */
.bar { height: 8px; background: #e7eeed; border-radius: 99px; overflow: hidden; margin: 6px 0; }
.bar i { display: block; height: 100%; background: var(--pri); border-radius: 99px; }
.bar.ok i { background: var(--green); } .bar.bad i { background: var(--red); }

/* người */
.av { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 50%; color: #fff; font-weight: 700; flex-shrink: 0; font-size: 15px; }
.av.sm { width: 24px; height: 24px; font-size: 11px; border: 2px solid #fff; }
.people { display: grid; gap: 10px; }
@media (min-width: 640px) { .people { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1100px) { .people { grid-template-columns: 1fr 1fr 1fr; } }
.person { border: 1px solid var(--line); border-left: 4px solid var(--pri); border-radius: 12px; padding: 12px; text-decoration: none; color: var(--tx); background: #fbfdfd; }
.person:hover { background: #f3faf9; }
.p-h { display: flex; gap: 10px; align-items: center; margin-bottom: 6px; }
.p-h small { display: block; color: var(--mu); font-size: 12.5px; }
.p-s { font-size: 13px; color: var(--mu); }

/* bộ lọc */
.toolbar { display: flex; gap: 8px; justify-content: flex-end; margin-bottom: 10px; flex-wrap: wrap; }
.filters { background: #fff; border-radius: var(--r); padding: 10px; box-shadow: var(--sh); margin-bottom: 8px; display: flex; flex-direction: column; gap: 8px; }
.frow { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.frow > * { flex: 1 1 140px; }
.frow > .btn, .frow > .ck { flex: 0 0 auto; }
input, select, textarea { width: 100%; padding: 9px 11px; border: 1px solid #cfdad8; border-radius: 10px; background: #fff; min-height: 40px; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(15, 118, 110, .35); border-color: var(--pri); }
input[type=checkbox], input[type=radio] { width: auto; min-height: 0; accent-color: var(--pri); }
input[type=range] { padding: 0; border: 0; accent-color: var(--pri); }
textarea { resize: vertical; }
.dl { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--mu); white-space: nowrap; }
.ck { display: flex; align-items: center; gap: 6px; cursor: pointer; }

/* thẻ công việc */
.tlist { display: grid; gap: 10px; }
@media (min-width: 760px) { .tlist { grid-template-columns: 1fr 1fr; } }
.tcard { display: block; background: #fff; border-radius: var(--r); padding: 12px 14px; text-decoration: none; color: var(--tx); box-shadow: var(--sh); border-left: 4px solid transparent; }
.tcard.late { border-left-color: var(--red); } .tcard.soon { border-left-color: #f59e0b; }
.tcard:hover { box-shadow: 0 3px 14px rgba(16, 40, 36, .12); }
.tc-top { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.cat { font-size: 12px; color: var(--pri-d); background: var(--pri-l); padding: 1px 8px; border-radius: 6px; }
.tc-top .prio { margin-left: auto; }
.tc-title { font-weight: 700; font-size: 15.5px; margin: 6px 0; color: #0b3d39; }
.tc-meta { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--mu); }
.avs { display: inline-flex; } .avs .av + .av { margin-left: -7px; }
.who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tc-row { display: flex; gap: 12px; font-size: 13px; color: var(--mu); margin-top: 6px; }
.tc-row .pct { margin-left: auto; font-weight: 700; color: var(--tx); }
.tc-foot { margin-top: 4px; }

/* chi tiết */
.t-head { margin: 2px 2px 10px; }
.crumb { color: var(--mu); font-size: 13px; }
.t-head h1 { font-size: 21px; margin: 4px 0 8px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.actions.end { justify-content: flex-end; margin: 6px 0 0; }
.info dl { display: grid; grid-template-columns: 130px 1fr; margin: 0; }
.info dt, .info dd { padding: 8px 0; border-bottom: 1px solid var(--line); margin: 0; }
.info dt { font-weight: 600; color: var(--mu); font-size: 14px; }
.info dd { text-align: right; }
.desc { white-space: pre-wrap; background: #f7faf9; border-radius: 10px; padding: 10px; font-size: 14.5px; }
.prog { margin-top: 12px; }
.done-box { border: 1.5px solid #86c9a5; }
.reports { border: 1px solid var(--line); border-radius: 10px; padding: 4px 12px; margin-bottom: 8px; }
.asg { display: flex; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.asg:first-of-type { border-top: 0; }
.asg-b { flex: 1; min-width: 0; }
.file { padding: 7px 0; border-top: 1px solid var(--line); word-break: break-word; }
.file:first-of-type { border-top: 0; }
.upl { display: inline-block; margin-top: 8px; color: var(--pri); font-weight: 600; cursor: pointer; font-size: 14px; border: 1px dashed #9fc9c3; border-radius: 10px; padding: 7px 12px; }
.alert { border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; font-size: 14px; }
.alert.red { background: #fee2e2; color: #7f1d1d; } .alert.violet { background: #ede9fe; color: #4c1d95; } .alert.amber { background: #fef3c7; color: #78350f; }
.chat { display: flex; flex-direction: column; gap: 8px; max-height: 420px; overflow-y: auto; margin-bottom: 8px; }
.msg { display: flex; gap: 8px; align-items: flex-end; }
.msg > div { background: #f1f5f4; border-radius: 12px 12px 12px 3px; padding: 6px 11px; max-width: 85%; }
.msg.me { justify-content: flex-end; } .msg.me > div { background: var(--pri-l); border-radius: 12px 12px 3px 12px; }
.msg small { color: var(--mu); font-size: 11.5px; } .msg p { margin: 2px 0 0; white-space: pre-wrap; word-break: break-word; }
.cmt { display: flex; gap: 8px; align-items: flex-end; }
.cmt textarea { min-height: 42px; }
.log { padding: 8px 0; border-top: 1px solid var(--line); }
.log:first-child { border-top: 0; }
.log small { color: var(--mu); } .log p { margin: 2px 0 0; white-space: pre-wrap; font-size: 14px; }

/* biểu mẫu */
.form label { display: block; margin-bottom: 12px; font-weight: 600; font-size: 14px; }
.form label input, .form label select, .form label textarea { margin-top: 4px; font-weight: 400; }
.form label small { font-weight: 400; }
.form .frow label { flex: 1 1 160px; }
.form .ck { font-weight: 500; }
.checks { display: grid; gap: 6px; margin: 4px 0 14px; }
@media (min-width: 560px) { .checks { grid-template-columns: 1fr 1fr; } }
.ckbox { display: flex !important; gap: 8px; align-items: center; border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px; margin: 0 !important; cursor: pointer; font-weight: 500 !important; }
.ckbox:has(input:checked) { border-color: var(--pri); background: #f0faf8; }
.ckbox span small { display: block; color: var(--mu); font-size: 12px; font-weight: 400; }
.ratings { display: grid; gap: 6px; margin: 4px 0 12px; }
.rbox { display: flex !important; gap: 8px; align-items: center; border: 1.5px solid var(--line); border-radius: 10px; padding: 9px 12px; margin: 0 !important; cursor: pointer; }
.rbox:has(input:checked) { border-color: var(--pri); background: #f0faf8; }

/* KPI */
.kpi-cards { display: flex; flex-direction: column; gap: 10px; }
.kcard { background: #fff; border-radius: var(--r); box-shadow: var(--sh); padding: 0 14px; }
.kcard summary { display: flex; gap: 10px; align-items: center; padding: 12px 0; cursor: pointer; list-style: none; }
.kcard summary::-webkit-details-marker { display: none; }
.kc-h { flex: 1; min-width: 0; } .kc-h small { display: block; color: var(--mu); font-size: 12.5px; }
.kc-big { text-align: right; } .kc-big b { font-size: 22px; color: var(--pri); display: block; line-height: 1; } .kc-big small { color: var(--mu); font-size: 11.5px; }
.kgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.kb { background: #f5f9f8; border-radius: 10px; padding: 8px 4px; text-align: center; }
.kb b { display: block; font-size: 19px; } .kb small { font-size: 11.5px; color: var(--mu); line-height: 1.2; display: block; }
.rbar { margin: 10px 0; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: 13px; }
.ktable { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 12px; }
.ktable th, .ktable td { padding: 6px 4px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.ktable th { color: var(--mu); font-weight: 600; font-size: 12px; }

/* nhân viên */
.ulist { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.ucard { display: flex; gap: 10px; align-items: center; background: #fff; border-radius: var(--r); padding: 12px; box-shadow: var(--sh); }
.ucard.off { opacity: .6; }
.ub { flex: 1; min-width: 0; } .ub small { display: block; font-size: 12.5px; }
.me-h { display: flex; gap: 12px; align-items: center; } .me-h small { display: block; color: var(--mu); }

/* hộp thoại */
.modal-wrap { position: fixed; inset: 0; background: rgba(10, 25, 23, .45); z-index: 50; display: flex; align-items: flex-end; justify-content: center; opacity: 0; transition: opacity .2s; }
.modal-wrap.show { opacity: 1; }
.modal { background: #fff; width: 100%; max-width: 560px; max-height: 92vh; display: flex; flex-direction: column; border-radius: 18px 18px 0 0; transform: translateY(30px); transition: transform .2s; padding-bottom: var(--safe-b); }
.modal-wrap.show .modal { transform: none; }
@media (min-width: 640px) { .modal-wrap { align-items: center; } .modal { border-radius: 18px; } }
.modal-h { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px 6px 16px; }
.modal-h h3 { font-size: 17px; } .modal-h .icon-btn { color: var(--mu); font-size: 18px; }
.modal-b { padding: 4px 16px 8px; overflow-y: auto; }
.modal-b label { display: block; margin-bottom: 10px; font-weight: 600; font-size: 14px; }
.modal-b label input, .modal-b label textarea, .modal-b label select { margin-top: 4px; font-weight: 400; }
.modal-f { display: flex; gap: 8px; justify-content: flex-end; padding: 10px 16px 14px; border-top: 1px solid var(--line); }

/* thông báo */
.notif-panel { position: fixed; top: 60px; right: 8px; left: 8px; max-width: 420px; margin-left: auto; max-height: 70vh; overflow-y: auto; background: #fff; border-radius: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, .2); z-index: 40; }
.np-h { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; }
.np-i { display: flex; flex-direction: column; padding: 10px 14px; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--tx); font-size: 14px; }
.np-i.unread { background: #f0faf8; } .np-i.unread span { font-weight: 600; }
.np-i small { color: var(--mu); font-size: 12px; }
.np-i.k-overdue span { color: var(--red); } .np-i.k-due span { color: var(--amber); }
.toast { position: fixed; left: 50%; bottom: calc(90px + var(--safe-b)); transform: translate(-50%, 20px); background: #1f2937; color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; z-index: 60; opacity: 0; transition: all .25s; max-width: 92vw; text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--red); }

/* đăng nhập */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: linear-gradient(160deg, #0f766e 0%, #115e59 45%, #eef5f4 45.1%); }
.login-card { background: #fff; border-radius: 20px; padding: 24px 20px; width: 100%; max-width: 400px; box-shadow: 0 12px 40px rgba(0, 0, 0, .15); }
.brand { display: flex; gap: 12px; align-items: center; margin-bottom: 18px; }
.brand img { width: 56px; height: 56px; border-radius: 14px; }
.brand h1 { font-size: 20px; } .brand p { margin: 2px 0 0; color: var(--mu); font-size: 13px; }
.login label { display: block; margin-bottom: 12px; font-weight: 600; font-size: 14px; }
.login label input { margin-top: 4px; }
.demo-box { margin-top: 16px; background: #fffbeb; border: 1px solid #fde68a; border-radius: 12px; padding: 10px; font-size: 13px; }
.demo-acc { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 8px; }
.chip-btn { background: #fff; border: 1px solid #e5d9a8; border-radius: 10px; padding: 7px; cursor: pointer; text-align: left; display: flex; flex-direction: column; }
.chip-btn span { color: var(--mu); font-size: 12px; }
.splash { min-height: 80vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: var(--mu); text-align: center; padding: 20px; }
.splash img { width: 72px; height: 72px; border-radius: 18px; }
.loading { padding: 40px; text-align: center; color: var(--mu); }
code { background: #eef2f1; padding: 1px 5px; border-radius: 4px; font-size: 13px; }

.filters details.more summary { cursor: pointer; color: var(--pri); font-weight: 600; font-size: 14px; padding: 2px 2px 4px; }
.filters details.more[open] summary { margin-bottom: 8px; }
.filters details.more .frow { margin-bottom: 8px; }
