/* Mobile-first, không phụ thuộc thư viện ngoài, font hệ thống hỗ trợ tiếng Việt */
:root{
  --bg:#f6f7f5;--surface:#fff;--ink:#17201d;--muted:#5d6a65;--line:#e2e6e3;
  --brand:#0f766e;--brand-ink:#fff;--brand-soft:#e6f4f1;
  --ok:#15803d;--ok-soft:#e8f6ec;--warn:#a16207;--warn-soft:#fdf6e3;--err:#b91c1c;--err-soft:#fdecec;
  --r:12px;--shadow:0 1px 2px rgba(0,0,0,.04),0 4px 16px rgba(0,0,0,.04);
  font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sans-serif;
}
*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{margin:0;background:var(--bg);color:var(--ink);font-size:16px;line-height:1.55}
a{color:var(--brand)}
h1,h2,h3{line-height:1.25;margin:0 0 .5em}
h1{font-size:1.6rem}h2{font-size:1.25rem}h3{font-size:1.05rem}
p{margin:0 0 1em}
.wrap{max-width:1120px;margin:0 auto;padding:0 16px}
.page{padding-top:20px;padding-bottom:48px;min-height:60vh}
.muted{color:var(--muted)}
.small{font-size:.875rem}
.skip{position:absolute;left:-999px}.skip:focus{left:8px;top:8px;background:#fff;padding:8px;z-index:9}
.inline{display:inline}

/* Header */
.topbar{background:var(--surface);border-bottom:1px solid var(--line);position:sticky;top:0;z-index:5}
.topbar__in{display:flex;align-items:center;gap:12px;min-height:56px;flex-wrap:wrap}
.brand{font-weight:700;font-size:1.1rem;text-decoration:none;color:var(--ink);display:flex;align-items:center;gap:8px;margin-right:auto}
.brand__mark{display:inline-grid;place-items:center;width:28px;height:28px;border-radius:8px;background:var(--brand);color:#fff;font-size:.9rem}
.navtoggle{border:1px solid var(--line);background:#fff;border-radius:8px;padding:6px 12px;font:inherit}
.nav{display:none;width:100%;flex-direction:column;padding:8px 0 12px;gap:2px}
.nav--open{display:flex}
.nav a,.linkbtn{padding:10px 8px;text-decoration:none;color:var(--ink);border-radius:8px;font:inherit;text-align:left}
.nav a:hover,.linkbtn:hover{background:var(--brand-soft)}
.nav__admin{color:var(--brand)!important;font-weight:600}
.linkbtn{background:none;border:0;cursor:pointer;width:100%}
@media(min-width:900px){
  .navtoggle{display:none}
  .nav{display:flex;width:auto;flex-direction:row;align-items:center;padding:0}
  .linkbtn{width:auto}
}

/* Buttons & forms */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;background:var(--brand);color:var(--brand-ink)!important;border:0;border-radius:10px;padding:12px 18px;font:inherit;font-weight:600;text-decoration:none;cursor:pointer;min-height:44px}
.btn:hover{filter:brightness(1.07)}
.btn[disabled],.btn--disabled{background:#c9d1ce;cursor:not-allowed;filter:none}
.btn--ghost{background:#fff;color:var(--ink)!important;border:1px solid var(--line)}
.btn--danger{background:var(--err)}
.btn--sm{padding:6px 12px;min-height:34px;font-size:.9rem}
.btn--block{width:100%}
label{display:block;font-weight:600;margin:0 0 4px;font-size:.95rem}
.field{margin-bottom:14px}
.hint{font-size:.85rem;color:var(--muted);margin-top:4px;font-weight:400}
input:not([type]),input[type=text],input[type=email],input[type=password],input[type=number],input[type=url],input[type=date],input[type=datetime-local],select,textarea{
  width:100%;padding:11px 12px;border:1px solid #cfd6d3;border-radius:10px;font:inherit;background:#fff;color:var(--ink)}
input:focus,select:focus,textarea:focus{outline:2px solid var(--brand);outline-offset:1px;border-color:var(--brand)}
textarea{min-height:90px}
.check{display:flex;gap:8px;align-items:flex-start;font-weight:400}
.check input{margin-top:5px}
.form-narrow{max-width:440px;margin:0 auto}
.row{display:grid;gap:12px}
@media(min-width:640px){.row--2{grid-template-columns:1fr 1fr}.row--3{grid-template-columns:repeat(3,1fr)}.row--4{grid-template-columns:repeat(4,1fr)}}

/* Cards & layout */
.card{background:var(--surface);border:1px solid var(--line);border-radius:var(--r);padding:18px;box-shadow:var(--shadow);margin-bottom:16px}
.card h2:first-child,.card h3:first-child{margin-top:0}
.grid{display:grid;gap:12px}
.grid--stats{grid-template-columns:repeat(2,1fr)}
@media(min-width:760px){.grid--stats{grid-template-columns:repeat(4,1fr)}.grid--3{grid-template-columns:repeat(3,1fr)}.grid--2{grid-template-columns:1fr 1fr}}
.stat{background:var(--surface);border:1px solid var(--line);border-radius:var(--r);padding:14px}
.stat__label{font-size:.85rem;color:var(--muted)}
.stat__value{font-size:1.35rem;font-weight:700;font-variant-numeric:tabular-nums;margin-top:2px}
.stat--brand{background:var(--brand);color:#fff;border-color:var(--brand)}
.stat--brand .stat__label{color:#d4efea}
.pagehead{display:flex;justify-content:space-between;align-items:flex-end;gap:12px;flex-wrap:wrap;margin-bottom:16px}
.pagehead h1{margin:0}

/* Alerts & badges */
.alert{padding:12px 14px;border-radius:10px;margin-bottom:14px;border:1px solid}
.alert--ok{background:var(--ok-soft);border-color:#bfe5cb;color:#14532d}
.alert--error{background:var(--err-soft);border-color:#f5c2c2;color:#7f1d1d}
.alert--warn{background:var(--warn-soft);border-color:#f1dca4;color:#713f12}
.alert--info{background:var(--brand-soft);border-color:#bfe3dc;color:#134e4a}
.badge{display:inline-block;padding:2px 9px;border-radius:999px;font-size:.78rem;font-weight:600;background:#eef1ef;color:#3f4b47;white-space:nowrap}
.badge--active,.badge--available,.badge--confirmed,.badge--paid,.badge--done,.badge--sent,.badge--approved,.badge--verified_allowed{background:var(--ok-soft);color:var(--ok)}
.badge--pending,.badge--processing,.badge--clicked,.badge--started,.badge--draft,.badge--needs_info,.badge--approval_required,.badge--policy_unclear,.badge--reconciliation_required,.badge--manual_review,.badge--policy_review,.badge--open{background:var(--warn-soft);color:var(--warn)}
.badge--rejected,.badge--failed,.badge--prohibited,.badge--suspended,.badge--provider_error,.badge--profit_unsafe,.badge--expired,.badge--locked,.badge--soldout{background:var(--err-soft);color:var(--err)}

/* Tables */
.table-wrap{overflow-x:auto;-webkit-overflow-scrolling:touch;border:1px solid var(--line);border-radius:var(--r);background:#fff}
table{border-collapse:collapse;width:100%;font-size:.92rem}
th,td{padding:10px 12px;border-bottom:1px solid var(--line);text-align:left;vertical-align:top}
th{background:#fafbfa;font-weight:600;color:#3f4b47;white-space:nowrap}
tr:last-child td{border-bottom:0}
td.num,th.num{text-align:right;font-variant-numeric:tabular-nums;white-space:nowrap}
.empty{padding:28px;text-align:center;color:var(--muted);background:#fff;border:1px dashed var(--line);border-radius:var(--r)}
.pager{display:flex;gap:12px;align-items:center;justify-content:center;margin-top:14px}

/* Tasks */
.tasks{display:grid;gap:12px}
@media(min-width:760px){.tasks{grid-template-columns:repeat(2,1fr)}}
@media(min-width:1040px){.tasks{grid-template-columns:repeat(3,1fr)}}
.task{display:flex;flex-direction:column;gap:10px}
.task__top{display:flex;justify-content:space-between;gap:8px;align-items:flex-start}
.task__provider{font-size:.8rem;color:var(--muted);text-transform:uppercase;letter-spacing:.04em}
.task__reward{font-size:1.4rem;font-weight:700;color:var(--brand)}
.task__meta{display:flex;gap:12px;flex-wrap:wrap;font-size:.85rem;color:var(--muted)}
.task .btn{margin-top:auto}

/* Attendance */
.week{display:grid;grid-template-columns:repeat(7,1fr);gap:6px;margin:12px 0}
.day{text-align:center;padding:10px 2px;border-radius:10px;border:1px solid var(--line);background:#fff;font-size:.8rem}
.day b{display:block;font-size:1rem}
.day--done{background:var(--brand);color:#fff;border-color:var(--brand)}
.day--today{outline:2px solid var(--brand);outline-offset:1px}

/* Landing */
.hero{padding:40px 0 24px}
.hero h1{font-size:2rem;max-width:18ch}
@media(min-width:760px){.hero h1{font-size:2.6rem}}
.hero p{font-size:1.1rem;color:var(--muted);max-width:60ch}
.hero__cta{display:flex;gap:10px;flex-wrap:wrap;margin-top:18px}
.steps{counter-reset:s;display:grid;gap:12px}
@media(min-width:760px){.steps{grid-template-columns:repeat(3,1fr)}}
.step{position:relative;padding-top:52px}
.step::before{counter-increment:s;content:counter(s);position:absolute;top:16px;left:18px;width:30px;height:30px;border-radius:50%;background:var(--brand);color:#fff;display:grid;place-items:center;font-weight:700}
.section{margin:36px 0}
.prose{max-width:760px}
.prose h2{margin-top:1.6em}
.prose li{margin-bottom:.4em}
details{background:#fff;border:1px solid var(--line);border-radius:10px;padding:12px 14px;margin-bottom:8px}
summary{cursor:pointer;font-weight:600}
details[open] summary{margin-bottom:8px}

/* Footer */
.footer{border-top:1px solid var(--line);background:#fff;padding:28px 0;margin-top:24px}
.footer__in{display:grid;gap:16px}
@media(min-width:760px){.footer__in{grid-template-columns:2fr 1fr}}
.footer__nav{display:flex;flex-wrap:wrap;gap:6px 16px}
.footer__nav a{color:var(--muted);text-decoration:none}

/* Admin */
.admin{display:grid;gap:16px;padding-top:16px;padding-bottom:40px}
@media(min-width:1000px){.admin{grid-template-columns:220px 1fr;max-width:1400px}}
.sidebar{background:#fff;border:1px solid var(--line);border-radius:var(--r);padding:8px;align-self:start}
.sidebar a{display:block;padding:8px 10px;border-radius:8px;text-decoration:none;color:var(--ink);font-size:.92rem}
.sidebar a.on,.sidebar a:hover{background:var(--brand-soft);color:var(--brand)}
@media(max-width:999px){.sidebar{display:flex;overflow-x:auto;gap:2px}.sidebar a{white-space:nowrap}}
.kv{display:grid;grid-template-columns:max-content 1fr;gap:6px 16px;font-size:.93rem}
.kv dt{color:var(--muted)}.kv dd{margin:0}
.actions{display:flex;flex-wrap:wrap;gap:8px;align-items:flex-end}
.actions form{display:flex;gap:6px;flex-wrap:wrap;align-items:flex-end}
code{background:#f1f3f2;padding:1px 6px;border-radius:6px;font-size:.88em;word-break:break-all}
.qr{max-width:260px;width:100%;border-radius:10px;border:1px solid var(--line)}
.mfa-qr svg{max-width:220px;height:auto}
.center{text-align:center}
.pre{white-space:pre-line}
.admin>section{min-width:0}

/* ===================== v2: ví, duyệt thủ công, fintech ===================== */
:root{--pending:#b45309;--pending-soft:#fef3c7;--info:#1d4ed8;--info-soft:#e0ebff;--muted-soft:#eef1ef}
/* Nhóm trạng thái thống nhất toàn site */
.st{display:inline-flex;align-items:center;gap:6px;padding:3px 10px;border-radius:999px;font-size:.8rem;font-weight:600;white-space:nowrap}
.st::before{content:"";width:7px;height:7px;border-radius:50%;background:currentColor}
.st--doing{background:var(--info-soft);color:var(--info)}
.st--pending{background:var(--pending-soft);color:var(--pending)}
.st--approved{background:var(--ok-soft);color:var(--ok)}
.st--rejected{background:var(--err-soft);color:var(--err)}
.st--cancelled,.st--info{background:var(--muted-soft);color:#4b5853}

/* Thẻ số dư */
.balances{display:grid;gap:12px;grid-template-columns:1fr}
@media(min-width:760px){.balances{grid-template-columns:1.3fr 1fr 1fr}}
.bal{border-radius:16px;padding:18px;border:1px solid var(--line);background:#fff;display:flex;flex-direction:column;gap:6px;box-shadow:var(--shadow)}
.bal__label{font-size:.9rem;font-weight:600;color:var(--muted);display:flex;align-items:center;gap:8px}
.bal__value{font-size:1.9rem;font-weight:800;letter-spacing:-.01em;font-variant-numeric:tabular-nums;line-height:1.15}
.bal__hint{font-size:.85rem;color:var(--muted)}
.bal--available{background:linear-gradient(135deg,#0f766e,#115e59);color:#fff;border-color:#0f766e}
.bal--available .bal__label,.bal--available .bal__hint{color:#ccefe9}
.bal--available .bal__value{font-size:2.3rem}
.bal--available .btn{background:#fff;color:#0f766e!important;align-self:flex-start;margin-top:6px}
.bal--pending{border-left:5px solid var(--pending)}
.bal--pending .bal__value{color:var(--pending)}
.bal--withdrawn{border-left:5px solid #64748b}
.minis{display:grid;grid-template-columns:repeat(2,1fr);gap:10px;margin-top:12px}
@media(min-width:760px){.minis{grid-template-columns:repeat(5,1fr)}}
.mini{background:#fff;border:1px solid var(--line);border-radius:12px;padding:10px 12px}
.mini b{display:block;font-size:1.1rem;font-variant-numeric:tabular-nums}
.mini span{font-size:.8rem;color:var(--muted)}

/* Tabs & bộ lọc */
.tabs{display:flex;gap:6px;overflow-x:auto;padding-bottom:4px;margin-bottom:12px;-webkit-overflow-scrolling:touch}
.tabs a{white-space:nowrap;padding:8px 14px;border-radius:999px;border:1px solid var(--line);background:#fff;color:var(--ink);text-decoration:none;font-size:.9rem}
.tabs a.on{background:var(--ink);color:#fff;border-color:var(--ink)}
.filters{display:grid;gap:8px;grid-template-columns:1fr 1fr;background:#fff;border:1px solid var(--line);border-radius:12px;padding:12px;margin-bottom:12px}
.filters .field{margin:0}
.filters label{font-size:.8rem;color:var(--muted);font-weight:600}
.filters input,.filters select{padding:8px 10px}
.filters .filters__actions{display:flex;gap:6px;align-items:flex-end}
@media(min-width:900px){.filters{grid-template-columns:repeat(6,1fr)}}

/* Bảng responsive: < 700px mỗi dòng thành thẻ */
@media(max-width:699px){
  .rtable thead{display:none}
  .rtable,.rtable tbody,.rtable tr,.rtable td{display:block;width:100%}
  .rtable tr{border-bottom:1px solid var(--line);padding:10px 12px}
  .rtable td{border:0;padding:3px 0;display:flex;justify-content:space-between;gap:12px;text-align:right}
  .rtable td::before{content:attr(data-label);color:var(--muted);font-size:.82rem;text-align:left;flex-shrink:0}
  .rtable td.rtable__main{display:block;text-align:left;font-weight:600}
  .rtable td.rtable__main::before{content:none}
  .rtable td.num{text-align:right}
  .table-wrap:has(.rtable){overflow:visible}
}

/* Dòng giao dịch ví */
.txlist{list-style:none;margin:0;padding:0}
.tx{display:grid;grid-template-columns:36px 1fr auto;gap:10px;padding:12px 0;border-bottom:1px solid var(--line);align-items:start}
.tx:last-child{border-bottom:0}
.tx__icon{width:36px;height:36px;border-radius:10px;display:grid;place-items:center;font-weight:700}
.tx__icon--pending{background:var(--pending-soft);color:var(--pending)}
.tx__icon--move{background:var(--ok-soft);color:var(--ok)}
.tx__icon--plus{background:var(--ok-soft);color:var(--ok)}
.tx__icon--minus{background:var(--err-soft);color:var(--err)}
.tx__title{font-weight:600}
.tx__sub,.tx__meta{font-size:.82rem;color:var(--muted)}
.tx__note{font-size:.82rem;color:#3f4b47;background:#f6f7f5;border-radius:8px;padding:6px 8px;margin-top:4px}
.tx__amt{text-align:right;font-weight:700;font-variant-numeric:tabular-nums;white-space:nowrap}
.tx__amt--pending{color:var(--pending)}
.tx__amt--move{color:var(--ok)}
.tx__amt--plus{color:var(--ok)}
.tx__amt--minus{color:var(--err)}
.tx__where{display:block;font-size:.75rem;font-weight:500;color:var(--muted)}

/* Biểu đồ cột (SVG/CSS, không JS) */
.chart{display:flex;align-items:flex-end;gap:4px;height:160px;padding:8px 0 0;border-bottom:1px solid var(--line)}
.chart__bar{flex:1;display:flex;flex-direction:column;justify-content:flex-end;align-items:center;height:100%;min-width:0}
.chart__fill{width:100%;max-width:28px;background:var(--brand);border-radius:6px 6px 0 0;min-height:2px}
.chart__fill--zero{background:#d9dfdc}
.chart__labels{display:flex;gap:4px;font-size:.68rem;color:var(--muted);margin-top:4px}
.chart__labels span{flex:1;text-align:center;min-width:0;overflow:hidden}
.chart__labels span:nth-child(even){visibility:hidden}
@media(min-width:760px){.chart__labels span:nth-child(even){visibility:visible}}
.h-pct-0{height:0}
.h-pct-1{height:1%}.h-pct-2{height:2%}.h-pct-3{height:3%}.h-pct-4{height:4%}.h-pct-5{height:5%}.h-pct-6{height:6%}.h-pct-7{height:7%}.h-pct-8{height:8%}.h-pct-9{height:9%}.h-pct-10{height:10%}.h-pct-11{height:11%}.h-pct-12{height:12%}.h-pct-13{height:13%}.h-pct-14{height:14%}.h-pct-15{height:15%}.h-pct-16{height:16%}.h-pct-17{height:17%}.h-pct-18{height:18%}.h-pct-19{height:19%}.h-pct-20{height:20%}.h-pct-21{height:21%}.h-pct-22{height:22%}.h-pct-23{height:23%}.h-pct-24{height:24%}.h-pct-25{height:25%}.h-pct-26{height:26%}.h-pct-27{height:27%}.h-pct-28{height:28%}.h-pct-29{height:29%}.h-pct-30{height:30%}.h-pct-31{height:31%}.h-pct-32{height:32%}.h-pct-33{height:33%}.h-pct-34{height:34%}.h-pct-35{height:35%}.h-pct-36{height:36%}.h-pct-37{height:37%}.h-pct-38{height:38%}.h-pct-39{height:39%}.h-pct-40{height:40%}.h-pct-41{height:41%}.h-pct-42{height:42%}.h-pct-43{height:43%}.h-pct-44{height:44%}.h-pct-45{height:45%}.h-pct-46{height:46%}.h-pct-47{height:47%}.h-pct-48{height:48%}.h-pct-49{height:49%}.h-pct-50{height:50%}.h-pct-51{height:51%}.h-pct-52{height:52%}.h-pct-53{height:53%}.h-pct-54{height:54%}.h-pct-55{height:55%}.h-pct-56{height:56%}.h-pct-57{height:57%}.h-pct-58{height:58%}.h-pct-59{height:59%}.h-pct-60{height:60%}.h-pct-61{height:61%}.h-pct-62{height:62%}.h-pct-63{height:63%}.h-pct-64{height:64%}.h-pct-65{height:65%}.h-pct-66{height:66%}.h-pct-67{height:67%}.h-pct-68{height:68%}.h-pct-69{height:69%}.h-pct-70{height:70%}.h-pct-71{height:71%}.h-pct-72{height:72%}.h-pct-73{height:73%}.h-pct-74{height:74%}.h-pct-75{height:75%}.h-pct-76{height:76%}.h-pct-77{height:77%}.h-pct-78{height:78%}.h-pct-79{height:79%}.h-pct-80{height:80%}.h-pct-81{height:81%}.h-pct-82{height:82%}.h-pct-83{height:83%}.h-pct-84{height:84%}.h-pct-85{height:85%}.h-pct-86{height:86%}.h-pct-87{height:87%}.h-pct-88{height:88%}.h-pct-89{height:89%}.h-pct-90{height:90%}.h-pct-91{height:91%}.h-pct-92{height:92%}.h-pct-93{height:93%}.h-pct-94{height:94%}.h-pct-95{height:95%}.h-pct-96{height:96%}.h-pct-97{height:97%}.h-pct-98{height:98%}.h-pct-99{height:99%}.h-pct-100{height:100%}

/* Bell, tiến trình, hộp xác nhận, skeleton */
.bell{position:relative}
.bell__n{display:inline-block;min-width:18px;padding:0 5px;border-radius:999px;background:var(--err);color:#fff;font-size:.72rem;font-weight:700;text-align:center;margin-left:4px}
.steps-v{list-style:none;margin:0;padding:0}
.steps-v li{position:relative;padding:0 0 14px 26px}
.steps-v li::before{content:"";position:absolute;left:6px;top:6px;width:10px;height:10px;border-radius:50%;background:#cfd6d3}
.steps-v li.done::before{background:var(--brand)}
.steps-v li::after{content:"";position:absolute;left:10px;top:18px;bottom:0;width:2px;background:#e2e6e3}
.steps-v li:last-child::after{display:none}
.confirmbox{border:2px solid var(--brand);border-radius:12px;padding:14px;background:var(--brand-soft)}
.confirmbox--danger{border-color:var(--err);background:var(--err-soft)}
.bigmoney{font-size:1.6rem;font-weight:800;font-variant-numeric:tabular-nums}
.bulkbar{position:sticky;bottom:0;background:#fff;border:1px solid var(--line);border-radius:12px;padding:10px 12px;display:flex;gap:10px;align-items:center;justify-content:space-between;box-shadow:0 -4px 16px rgba(0,0,0,.06);margin-top:10px;flex-wrap:wrap}
.hourhead{display:flex;justify-content:space-between;align-items:center;background:#f1f5f3;padding:8px 12px;font-weight:700;border-bottom:1px solid var(--line)}
.btn.is-loading{opacity:.7;pointer-events:none}
.btn.is-loading::after{content:"";width:14px;height:14px;border:2px solid currentColor;border-right-color:transparent;border-radius:50%;animation:spin .7s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}
.skeleton{background:linear-gradient(90deg,#eef1ef 25%,#f7f8f7 50%,#eef1ef 75%);background-size:200% 100%;animation:sk 1.2s infinite;border-radius:8px;min-height:1em}
@keyframes sk{to{background-position:-200% 0}}
.split{display:grid;gap:16px}
@media(min-width:900px){.split{grid-template-columns:2fr 1fr}}
.kv--wide{grid-template-columns:minmax(120px,max-content) 1fr}
.right{text-align:right}
.nowrap{white-space:nowrap}
.mt0{margin-top:0}
.hide-sm{display:none}
@media(min-width:700px){.hide-sm{display:revert}}
a.mini,a.stat{color:inherit;text-decoration:none}
.split>*,.grid>*,.balances>*{min-width:0}
.pagehead .tabs{margin-bottom:0}
.tx__where{white-space:normal;max-width:120px;margin-left:auto}
@media(max-width:480px){.tx{grid-template-columns:30px 1fr auto}.tx__icon{width:30px;height:30px}.bal__value{font-size:1.6rem}.bal--available .bal__value{font-size:1.9rem}}
.filters>*{min-width:0}
@media(max-width:699px){.rtable td{flex-wrap:wrap}.rtable td>.st{white-space:normal}}
