:root {
  /* Nhận diện Hamec (giống lichlamviec.hamec.vn) */
  --brand: #3e7b1d; --brand-2: #4a8f22; --brand-soft: #eaf3e2; --brand-ink: #1d4d1f; --accent: #e31e25;
  --bg: #f5f7f2; --surface: #ffffff; --surface-2: #f7f9f4; --border: #e1e8da; --border-2: #cdd8c4;
  --text: #1a2614; --muted: #5f6d57; --faint: #93a08a;
  --warn: #b45309; --warn-bg: #fff4e0; --danger: #c0392b; --danger-bg: #fdecea; --ok: #15803d; --ok-bg: #e5f6ea; --info: #1d4ed8; --info-bg: #e8effd;
  --shadow: 0 1px 2px rgba(16, 40, 28, .05), 0 4px 16px rgba(16, 40, 28, .05);
  --r: 14px; --r-s: 9px;
  --tab-h: 62px;
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.5 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', sans-serif; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 21px; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 17px; font-weight: 600; }
h3 { font-size: 15px; font-weight: 600; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
.muted { color: var(--muted); } .faint { color: var(--faint); }
.small { font-size: 13px; } .xs { font-size: 12px; }
.row { display: flex; align-items: center; } .grow { flex: 1; min-width: 0; }
.gap-s { gap: 6px; } .gap { gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.ic { flex: none; }

.loading { display: flex; gap: 10px; align-items: center; justify-content: center; padding: 48px; color: var(--muted); }
.spin { width: 18px; height: 18px; border: 2px solid var(--border-2); border-top-color: var(--brand); border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Nút & ô nhập ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 11px; border: 1px solid var(--border-2); background: var(--surface); font-weight: 600; cursor: pointer; text-decoration: none; transition: background .15s; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--brand-2); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-block { width: 100%; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 600; color: var(--muted); }
.input { height: 46px; padding: 0 14px; border-radius: 11px; border: 1px solid var(--border-2); background: var(--surface); width: 100%; font-size: 16px; }
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.msg { padding: 10px 12px; border-radius: var(--r-s); font-size: 14px; }
.msg.err { background: var(--danger-bg); color: var(--danger); }
.msg.ok { background: var(--ok-bg); color: var(--ok); }
.msg.info { background: var(--info-bg); color: var(--info); }

/* ---------- Đăng nhập ---------- */
.login { min-height: 100vh; display: flex; flex-direction: column; align-items: center; padding: 0 16px 24px; }
.login-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow); padding: 26px 20px; }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.login-brand img { width: 48px; height: 48px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 4px; margin-bottom: 16px; }
.seg button { border: 0; background: transparent; border-radius: 9px; min-height: 38px; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--brand-ink); box-shadow: var(--shadow); }

/* ---------- Khung app ---------- */
.top { position: sticky; top: 0; z-index: 20; background: rgba(245, 247, 242, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); padding: calc(10px + env(safe-area-inset-top)) 16px 10px; display: flex; align-items: center; gap: 10px; }
.top img { width: 30px; height: 30px; }
.top .who { line-height: 1.2; min-width: 0; }
/* overflow:hidden (để hiện …) cắt mất dấu chồng của chữ hoa tiếng Việt (Ế, Ả, Ỗ) nếu dòng thấp → dòng cao hơn */
.top .who b { display: block; font-size: 15px; line-height: 1.5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .who small { color: var(--muted); font-size: 12px; }
.main { padding: 16px 16px calc(var(--tab-h) + 24px + env(safe-area-inset-bottom)); max-width: 760px; margin: 0 auto; }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--surface); border-top: 1px solid var(--border); display: grid; grid-template-columns: repeat(5, 1fr); padding-bottom: env(safe-area-inset-bottom); }
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; height: var(--tab-h); color: var(--faint); text-decoration: none; font-size: 11.5px; font-weight: 600; }
.tabbar a.on { color: var(--brand); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px; }
.page-head { margin-bottom: 14px; }
.page-head p { margin-top: 3px; }
.list { display: flex; flex-direction: column; }
.list a, .list .item { display: flex; align-items: center; gap: 12px; padding: 14px 4px; border-bottom: 1px solid var(--border); text-decoration: none; color: inherit; }
.list a:last-child, .list .item:last-child { border-bottom: 0; }
.chip { display: inline-flex; align-items: center; height: 24px; padding: 0 9px; border-radius: 99px; background: var(--brand-soft); color: var(--brand-ink); font-size: 12px; font-weight: 600; }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.soon { text-align: center; padding: 36px 16px; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.soon .badge { width: 56px; height: 56px; border-radius: 16px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; font-weight: 500; text-align: right; }

/* Màn hình rộng: thanh điều hướng thành cột trái */
/* Thanh bên máy tính — ẩn trên điện thoại */
.sidebar { display: none; }
.cols { display: grid; gap: 14px; }
@media (min-width: 1024px) {
  :root { --side: 248px; }
  .top, .tabbar { display: none; }
  .sidebar { display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; width: var(--side); background: var(--surface); border-right: 1px solid var(--border); padding: 18px 12px 14px; z-index: 30; }
  .brand { display: flex; gap: 10px; align-items: center; padding: 2px 8px 18px; color: var(--text); text-decoration: none; }
  .brand img { width: 40px; height: 40px; }
  .brand b { display: block; font-size: 16px; color: var(--brand-ink); } .brand small { color: var(--muted); font-size: 12px; }
  .side-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow: auto; }
  .side-nav a { display: flex; align-items: center; gap: 11px; height: 42px; padding: 0 12px; border-radius: 10px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: 14.5px; }
  .side-nav a:hover { background: var(--surface-2); color: var(--text); }
  .side-nav a.on { background: var(--brand-soft); color: var(--brand-ink); box-shadow: inset 3px 0 0 var(--brand); }
  .nav-sep { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); padding: 16px 12px 4px; font-weight: 700; }
  .side-foot { border-top: 1px solid var(--border); padding-top: 12px; display: flex; align-items: center; gap: 6px; }
  .side-foot .me { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; padding: 6px 8px; border-radius: 10px; color: var(--text); text-decoration: none; }
  .side-foot .me:hover, .side-foot .me.on { background: var(--surface-2); }
  .side-foot .me b { display: block; font-size: 13.5px; line-height: 1.25; }
  .side-foot .me small { display: block; color: var(--muted); font-size: 11.5px; line-height: 1.5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .avatar { flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-ink); display: grid; place-items: center; font-weight: 700; }
  .main { margin: 0 0 0 var(--side); padding: 28px 40px 48px; max-width: calc(1120px + var(--side)); }
  .cols { grid-template-columns: 1fr 1fr; align-items: start; }
  .stats { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)) !important; }
}
}

/* ---------- Màn hình dữ liệu ---------- */
.btn-icon { width: 40px; min-height: 40px; padding: 0; font-size: 22px; line-height: 1; }
.month-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.month-nav b { font-size: 16px; }
.seg-s { margin: 0; }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.stat { display: flex; flex-direction: column; gap: 2px; padding: 14px; text-decoration: none; color: inherit; min-width: 0; }
.stat small { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.stat b { font-size: 20px; font-weight: 700; letter-spacing: -.01em; overflow-wrap: anywhere; }
.card > h3 { margin-bottom: 10px; }
.card > .row h3 { margin-bottom: 0; }
.card > .row { margin-bottom: 10px; }
.shift { display: flex; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--brand-soft); border-left: 3px solid var(--brand); min-width: 0; flex: 1; }
.shift + .shift { margin-top: 6px; }
.shift.off { background: var(--surface-2); border-left-color: var(--faint); color: var(--muted); }
.stack-s { display: flex; flex-direction: column; gap: 6px; }
.date-badge { flex: none; width: 46px; text-align: center; font-weight: 700; font-size: 14px; line-height: 1.15; }
.date-badge small { display: block; font-size: 11px; color: var(--muted); font-weight: 600; }
.card .row.gap + .row.gap { margin-top: 8px; }
.item.day.today .date-badge { color: var(--brand); }
.empty-s { padding: 8px 0; }
.chip.bad { background: var(--danger-bg); color: var(--danger); }
.seg-4 { grid-template-columns: repeat(4, 1fr); }
.seg-4 button { font-size: 13px; padding: 0 2px; }
.chip.grey { background: var(--surface-2); color: var(--muted); }
.hi { color: var(--danger); font-weight: 600; }
.msg.info a { color: inherit; }

/* Lịch tháng */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; padding: 10px; }
.cal-h { text-align: center; font-size: 11.5px; font-weight: 600; color: var(--muted); padding: 2px 0 4px; }
.cal-cell { aspect-ratio: 1; border: 1px solid transparent; border-radius: 10px; background: var(--surface-2); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-weight: 600; cursor: pointer; padding: 0; }
.cal-cell.out { opacity: .35; }
.cal-cell.today span { color: var(--brand); }
.cal-cell.sel { border-color: var(--brand); background: var(--brand-soft); }
.dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--brand); }
.dot.off { background: var(--faint); }
.legend { display: flex; align-items: center; gap: 6px; }
.legend .dot + * { margin-right: 10px; }

/* Bảng công */
.table-wrap { overflow-x: auto; margin: 0 -4px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.tbl th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 6px 4px; border-bottom: 1px solid var(--border); }
.tbl td { padding: 8px 4px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl tr:last-child td { border-bottom: 0; }

/* Phiếu lương */
.pay { padding: 0; overflow: hidden; }
.pay-head { width: 100%; display: flex; align-items: center; gap: 10px; padding: 16px; border: 0; background: none; cursor: pointer; text-align: left; font-size: 15px; }
.pay-head:disabled { cursor: default; color: var(--muted); }
.pay-detail:not(:empty) { padding: 0 16px 16px; display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--border); padding-top: 14px; }
.pay-detail h3 { margin-top: 6px; }
.pay-net { display: flex; flex-direction: column; } .pay-net small { color: var(--muted); }
.pay-net .amt { font-size: 26px; font-weight: 700; color: var(--brand-ink); }
.pay-split { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pay-split > div { background: var(--surface-2); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; font-weight: 600; }
.pay-split small { color: var(--muted); font-weight: 500; font-size: 12px; }
.pay-row { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; font-variant-numeric: tabular-nums; }
.pay-row.total { border-top: 1px dashed var(--border-2); padding-top: 6px; font-weight: 700; }
.amt .mask { display: none; letter-spacing: 2px; }
.masked .amt .real { display: none; }
.masked .amt .mask { display: inline; }

@media (min-width: 640px) { .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* Đơn từ: lọc theo loại + người đang giữ đơn */
.pills { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; margin: -4px 0 12px; scrollbar-width: none; }
.pills::-webkit-scrollbar { display: none; }
.pill { flex: none; border: 1px solid var(--border); background: var(--surface); color: var(--muted); border-radius: 99px; height: 32px; padding: 0 12px; font-weight: 600; font-size: 13px; cursor: pointer; }
.pill.on { background: var(--brand-soft); color: var(--brand-ink); border-color: transparent; }
.hold { color: var(--warn); margin-top: 2px; }

/* KPI phòng khám */
.kpi { display: flex; flex-direction: column; gap: 10px; text-decoration: none; color: inherit; }
.kpi h3 { margin: 0; }
.kpi-big { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.kpi-big b { font-size: 30px; line-height: 1; letter-spacing: -.02em; }
.kpi-bar { position: relative; height: 10px; border-radius: 99px; background: var(--surface-2); overflow: visible; }
.kpi-bar .fill { position: absolute; inset: 0 auto 0 0; border-radius: 99px; background: var(--brand); }
.kpi-bar .fill.behind { background: var(--warn); }
.kpi-bar .fill.none { background: var(--faint); }
.kpi-bar .mark { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--text); border-radius: 2px; opacity: .55; }
.kpi-need { display: flex; flex-direction: column; gap: 2px; background: var(--brand-soft); border-radius: 12px; padding: 10px 12px; }
.kpi-need small { color: var(--brand-ink); font-weight: 600; }
.kpi-need b { font-size: 20px; color: var(--brand-ink); }
.kpi-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.kpi-grid small { display: block; color: var(--muted); font-size: 12px; }
.kpi-grid b { font-size: 14px; }
.kpi-days .bars { position: relative; height: 90px; display: flex; align-items: flex-end; gap: 3px; margin: 6px 0 4px; border-bottom: 1px solid var(--border); }
.kpi-days .b { flex: 1; min-width: 3px; max-width: 18px; background: var(--warn); opacity: .75; border-radius: 3px 3px 0 0; }
.kpi-days .b.up { background: var(--brand); opacity: 1; }
.kpi-days .goal { position: absolute; left: 0; right: 0; border-top: 1.5px dashed var(--muted); }
.kpi-link { gap: 12px; text-decoration: none; color: inherit; }
.kpi-list { display: grid; gap: 12px; }
@media (min-width: 1024px) { .kpi-list { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; } }

/* Quản trị */
.seg-3 { grid-template-columns: repeat(3, 1fr); }
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.tags .chip { height: 20px; font-size: 11px; padding: 0 7px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 16px; letter-spacing: .05em; user-select: all; }
.perm-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.perm-row:last-child { border-bottom: 0; }
.perm-group .nav-sep { padding: 10px 0 2px; display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); font-weight: 700; }
.dot { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--border); }
.dot.on { background: var(--ok); }
.input-s { width: auto; min-width: 118px; height: 36px; padding: 0 8px; font-size: 13px; }
.checks { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }
.matrix th, .matrix td { white-space: nowrap; font-size: 12.5px; }
.matrix td:first-child { white-space: normal; min-width: 220px; }
.matrix td.c { text-align: center; color: var(--ok); font-weight: 700; }
.warn-t { color: var(--danger); }
.btn-s { min-height: 30px; height: 30px; padding: 0 10px; font-size: 12px; }
.matrix input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--brand); cursor: pointer; }

/* Ô mật khẩu có nút hiện / ẩn */
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 48px; }
.pw-eye { position: absolute; top: 0; right: 0; width: 46px; height: 46px; display: grid; place-items: center; border: 0; background: transparent; color: var(--muted); cursor: pointer; border-radius: 0 11px 11px 0; }
.pw-eye:hover { color: var(--text); }
.pw-eye:focus-visible { outline: 2px solid var(--brand); outline-offset: -4px; }

/* Quản trị — bản dễ hiểu */
.back { display: inline-block; font-size: 14px; margin-bottom: 4px; }
.card.flush { padding: 4px 0; }
.acc-list { display: flex; flex-direction: column; }
.acc-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); cursor: pointer; }
.acc-row:last-child { border-bottom: 0; }
.acc-row:hover { background: var(--surface-2); }
.acc-main b { display: block; }
.acc-role { flex: none; }
.role-sel { min-width: 170px; }
.avatar.off { background: var(--surface-2); color: var(--faint); }
.avatar.lg { width: 52px; height: 52px; font-size: 20px; }
.person { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.person h2 { margin: 0 0 2px; }
.person .full { flex-basis: 100%; }
.role-cards { display: grid; gap: 8px; }
.role-card { display: flex; gap: 10px; align-items: flex-start; border: 1.5px solid var(--border); border-radius: 12px; padding: 10px 12px; cursor: pointer; background: var(--surface); }
.role-card.on { border-color: var(--brand); background: var(--brand-soft); }
.role-card.dis { cursor: default; opacity: .75; }
.role-card input { margin-top: 3px; accent-color: var(--brand); }
.role-card b { display: block; font-size: 14px; }
.role-card small { color: var(--muted); font-size: 12.5px; }
.sum-box { background: var(--surface-2); border-radius: 12px; padding: 10px 12px; }
.sum { margin: 6px 0 0; padding-left: 18px; font-size: 13.5px; display: grid; gap: 3px; }
.adv { border-top: 1px solid var(--border); padding-top: 8px; }
.adv > summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--brand-ink); padding: 4px 0; }
.perm-line { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border); cursor: pointer; }
.perm-line:last-child { border-bottom: 0; }
.perm-line.custom { background: linear-gradient(90deg, var(--warn-bg), transparent); }
.switch { appearance: none; -webkit-appearance: none; flex: none; width: 40px; height: 24px; border-radius: 99px; background: var(--border-2); position: relative; cursor: pointer; transition: background .15s; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
.switch:checked { background: var(--brand); }
.switch:checked::after { transform: translateX(16px); }
.switch:disabled { opacity: .55; cursor: default; }
.dot.bad { background: var(--danger); }
.mono.big { font-size: 22px; margin: 6px 0; }
.danger-zone { border-color: #f3c7c2; }
.grp { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); font-weight: 700; padding: 10px 0 2px; }
.role-box > summary { list-style: none; display: flex; align-items: center; gap: 10px; cursor: pointer; }
.role-box > summary::-webkit-details-marker { display: none; }
.role-box > summary .chip { margin-left: 8px; height: 20px; font-size: 11px; }
.role-box[open] > summary .ic { transform: rotate(90deg); }
.role-box[open] > summary { margin-bottom: 10px; }
.toast { position: fixed; left: 50%; bottom: calc(var(--tab-h) + 20px); transform: translate(-50%, 20px); background: var(--text); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; opacity: 0; pointer-events: none; transition: .2s; z-index: 50; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (min-width: 1024px) { .toast { bottom: 28px; } .role-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .acc-row { flex-wrap: wrap; } .acc-role { flex-basis: 100%; padding-left: 46px; } .acc-row > .ic { display: none; } .role-sel { width: 100%; } }
/* Ô chữ cái đầu tên — dùng cả trên điện thoại */
.avatar { flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-ink); display: grid; place-items: center; font-weight: 700; }
.avatar.lg { width: 52px; height: 52px; font-size: 20px; }
.avatar.off { background: var(--surface-2); color: var(--faint); }

/* Tài khoản */
.narrow { max-width: none; }
@media (min-width: 1024px) {
  /* Máy tính: hồ sơ bên trái, bảo mật bên phải, dùng hết chiều rộng */
  .acct-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 16px; align-items: start; }
  .profile { padding: 24px; }
  .profile h2 { font-size: 22px; }
  .profile .avatar.lg { width: 64px; height: 64px; font-size: 24px; }
  .info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 16px 20px; }
  .info-item b { font-size: 15px; }
  .sec { padding: 24px; }
  .sec-row b { font-size: 15px; }
  .pw-form { max-width: none; }
}
.profile { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.profile h2 { margin: 0 0 2px; font-size: 19px; }
.info-grid { flex-basis: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; border-top: 1px solid var(--border); padding-top: 14px; }
.info-item small { display: block; color: var(--muted); font-size: 12px; }
.info-item b { font-size: 14px; font-weight: 600; }
@media (min-width: 640px) { .info-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.sec h3 { margin: 0 0 4px; }
.sec-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); }
.sec-row > .ic { color: var(--muted); }
.sec-row b { font-size: 14.5px; }
.pw-form { max-width: 400px; padding: 2px 0 14px 32px; }

/* Ảnh bìa web app: dải "Tập thể HAMEC" (img/cover-team.jpg); trang đăng nhập máy tính dùng trọn poster 10 Phẩm giá */
.cover { position: relative; overflow: hidden; border-radius: 18px; color: #fff;
  background: linear-gradient(180deg, rgba(10,30,5,0) 25%, rgba(10,30,5,.55) 55%, rgba(10,30,5,.85)), url(/img/cover-team.jpg) center 60% / cover no-repeat, linear-gradient(135deg, #2f6b14, #9cc35a); }
.cover-text { position: absolute; left: 20px; right: 20px; bottom: 16px; display: flex; flex-direction: column; gap: 2px; text-shadow: 0 1px 6px rgba(0,0,0,.35); }
.cover-text b { font-size: 22px; line-height: 1.2; }
.cover-text span { font-size: 13px; opacity: .92; }
.login-cover { width: calc(100% + 32px); max-width: none; margin: 0 -16px -28px; height: 210px; border-radius: 0 0 24px 24px; }
.login-cover .cover-text { display: none; } /* khung đăng nhập bên dưới đã có tên cổng */
@media (max-width: 1023px) { .login-cover { background: url(/img/cover-team.jpg) center 55% / cover no-repeat, #4e8f22; } }
.login .login-card { position: relative; z-index: 1; }
.home-cover { height: 170px; margin-bottom: 16px; }
@media (min-width: 1024px) {
  .login { flex-direction: row; align-items: stretch; padding: 0; }
  /* Máy tính: hiện trọn poster, không cắt, nền xanh nhạt hòa với viền poster */
  .login-cover { flex: 1 1 58%; width: auto; height: auto; min-height: 100vh; margin: 0; border-radius: 0;
    background: url(/img/cover-poster.jpg) center / contain no-repeat, radial-gradient(circle at 50% 40%, #f4f9ee 0%, #dcebc8 70%, #c9e0ad 100%); }
  .login-cover .cover-text { display: none; }
  .login .login-card { align-self: center; margin: 0 auto; max-width: 420px; border: 0; box-shadow: none; background: transparent; padding: 32px 40px; }
  .login > form { flex: 0 0 42%; display: flex; flex-direction: column; justify-content: center; }
  .home-cover { height: 230px; background-position: 0 0, center 8%, 0 0; }
  .home-cover .cover-text { left: 28px; bottom: 22px; }
  .home-cover .cover-text b { font-size: 28px; }
}

/* KPI ở Tổng quan */
.kpi-days .b.empty { background: var(--surface-2); opacity: 1; height: 4px; }
.kpi-days .b.today { background: var(--brand-soft); height: 8px; }
.kpi-home { display: grid; gap: 14px; }
.kpi-home-main { display: flex; flex-direction: column; gap: 10px; }
@media (min-width: 1024px) { .kpi-home { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); align-items: center; gap: 28px; } .kpi-home .kpi-days .bars { height: 120px; } }
.board { display: block; text-decoration: none; color: inherit; }
.board-head { gap: 14px; align-items: flex-start; margin-bottom: 8px; }
.board-head h3 { margin: 0 0 2px; }
.board-total { text-align: right; display: flex; flex-direction: column; }
.board-total small { color: var(--muted); font-size: 12px; }
.board-total b { font-size: 24px; line-height: 1.1; }
.board-rows { display: flex; flex-direction: column; }
.board-row { display: grid; grid-template-columns: 1fr auto; grid-template-areas: 'name pct' 'bar bar' 'money money'; gap: 6px 10px; padding: 10px 0; border-top: 1px solid var(--border); }
.board-name { grid-area: name; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.board-name .chip { height: 20px; font-size: 11px; }
.board-bar { grid-area: bar; }
.board-pct { grid-area: pct; font-size: 16px; }
.board-money { grid-area: money; }
@media (min-width: 1024px) {
  .board-row { grid-template-columns: 220px minmax(0, 1fr) 64px 250px; grid-template-areas: 'name bar pct money'; align-items: center; }
  .board-pct { text-align: right; }
}

.soon-stat { opacity: .75; }
.soon-stat .chip { align-self: flex-start; margin-top: 6px; }

/* Học tập */
.learn-head { display: flex; flex-direction: column; gap: 10px; }
.learn-big { font-size: 28px; display: inline-block; margin-top: 2px; }
.learn-sec > summary { list-style: none; display: flex; align-items: center; gap: 12px; cursor: pointer; }
.learn-sec > summary::-webkit-details-marker { display: none; }
.learn-sec[open] > summary { margin-bottom: 6px; }
.learn-sec[open] > summary > .ic { transform: rotate(90deg); }
.mini-bar { width: 80px; height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; flex: none; }
.mini-bar span { display: block; height: 100%; background: var(--brand); }
.learn-item { font-size: 14.5px; }
.learn-item.sub { padding-left: 28px !important; }
.tick { flex: none; width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--border-2); display: grid; place-items: center; font-size: 13px; color: #fff; }
.tick.on { background: var(--ok); border-color: var(--ok); }
.doc { padding: 20px; }
.doc-title { font-size: 22px; margin: 4px 0 14px; line-height: 1.3; }
.doc-body { font-size: 15.5px; line-height: 1.65; overflow-wrap: anywhere; }
.doc-body h2 { font-size: 19px; margin: 22px 0 8px; } .doc-body h3 { font-size: 17px; margin: 18px 0 6px; } .doc-body h4 { font-size: 15.5px; margin: 14px 0 4px; }
.doc-body p { margin: 6px 0; } .doc-body .gap { height: 6px; }
.doc-body ul, .doc-body ol { margin: 6px 0; padding-left: 22px; } .doc-body li { margin: 3px 0; }
.doc-body blockquote { margin: 10px 0; padding: 10px 14px; background: var(--brand-soft); border-left: 3px solid var(--brand); border-radius: 0 10px 10px 0; }
.doc-body img { max-width: 100%; height: auto; border-radius: 10px; margin: 10px 0; display: block; }
.doc-body hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }
.doc-body pre { white-space: pre-wrap; background: var(--surface-2); padding: 10px; border-radius: 8px; font-size: 13.5px; }
.doc-tbl td, .doc-tbl th { vertical-align: top; min-width: 120px; font-size: 14px; white-space: normal; }
.doc-tbl td p, .doc-tbl th p { margin: 2px 0; }
.doc-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; border-top: 1px solid var(--border); margin-top: 20px; padding-top: 16px; }
.doc-nav { gap: 10px; }
@media (min-width: 1024px) { .doc { padding: 32px 40px; } .doc-title { font-size: 26px; } }
.learn-head small { display: block; margin-bottom: 2px; }

.sync-card { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.sync-btn { flex: none; }
.sync-row { align-items: center; }

/* ---------- Nền tĩnh + chức năng nổi (kiểu UMC Care, tông Hamec) — cả điện thoại và máy tính ---------- */
body { background: #eef6e7; }
/* lớp nền cố định: iOS không hỗ trợ background-attachment: fixed */
body::before { content: ''; position: fixed; inset: 0; z-index: -1; background: url(/img/bg-hamec.svg) center top / cover no-repeat; }
.card { background: rgba(255, 255, 255, .88); border-color: rgba(255, 255, 255, .9); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.home-brand { padding: 20px 4px 16px; }
/* Ngày hôm nay: chip nhỏ trên cùng; ảnh tập thể bên dưới chỉ để ảnh, không đè chữ */
.home-date { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--brand-ink); line-height: 1.5;
  background: rgba(255, 255, 255, .7); border: 1px solid rgba(255, 255, 255, .9); border-radius: 99px; padding: 4px 11px; margin-bottom: 26px; }
.home-org { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--brand-ink); font-weight: 500; line-height: 1.5; }
.home-org img { width: 26px; height: 26px; }
.home-brand h1 { font-size: 30px; font-weight: 700; color: var(--brand); letter-spacing: -.01em; line-height: 1.35; margin-top: 4px; }
.home-brand p { font-size: 13px; color: var(--muted); }
.func { padding: 16px 12px 8px; border-radius: 20px; }
.func h2 { font-size: 16px; color: var(--brand-ink); padding: 0 6px 12px; }
.func-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px 6px; }
.func-grid a { display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 4px 0 12px; text-decoration: none; color: var(--brand-ink); font-size: 12.5px; font-weight: 600; text-align: center; line-height: 1.35; }
.tile { width: 60px; height: 60px; border-radius: 18px; display: grid; place-items: center; background: linear-gradient(160deg, #fff 55%, #f1f8ea); border: 1px solid #dfead6; box-shadow: 0 3px 10px rgba(30, 70, 20, .09); transition: transform .15s; }
.tile img { width: 40px; height: 40px; }
.func-grid a:active .tile { transform: scale(.94); }
.home-head { display: none; } /* máy tính: đã có thanh bên, giữ Tổng quan như cũ */
@media (max-width: 1023px) {
  .top { background: rgba(236, 245, 228, .78); border-bottom-color: rgba(255, 255, 255, .6); }
  .is-home .top { display: none; }
  .is-home .main { padding-top: calc(28px + env(safe-area-inset-top)); }
  .home-head { display: block; margin-bottom: 14px; }
  /* ảnh tập thể chỉ để ảnh, không đè chữ */
  .is-home .home-cover .cover-text { display: none; }
  .is-home .home-cover { background: url(/img/cover-team.jpg) center 60% / cover no-repeat, #4e8f22; } /* không còn chữ → bỏ lớp phủ tối */
}
@media (min-width: 1024px) {
  /* Máy tính: chỉ thêm nền; thanh bên hơi trong để thấy nền, biểu tượng dùng hình minh họa như ô Chức năng */
  .sidebar { background: rgba(255, 255, 255, .9); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
  .side-nav .art { width: 24px; height: 24px; flex: none; }
}

/* Tab "Cá nhân": ảnh đại diện thay biểu tượng */
.tab-avatar { width: 26px; height: 26px; font-size: 12.5px; background: var(--surface-2); color: var(--faint); border: 1.5px solid currentColor; }
.tabbar a.on .tab-avatar { background: var(--brand); color: #fff; border-color: var(--brand); }
@media (max-width: 1023px) { .acct-grid { display: grid; gap: 12px; } } /* điện thoại: 2 thẻ xếp dọc, có khoảng cách */

/* Quản trị → Học tập: danh sách nhân viên, bấm để chọn thư mục */
.learn-filter .input[type=search] { flex: 1; }
.learn-filter select { width: auto; max-width: 45%; }
.learn-person { border-bottom: 1px solid var(--border); padding: 0 14px; }
.learn-person:last-child { border-bottom: 0; }
.learn-person > summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 12px 0; cursor: pointer; }
.learn-person > summary::-webkit-details-marker { display: none; }
.learn-person[open] > summary { border-bottom: 1px dashed var(--border); }
.learn-person .folder-pick { padding: 8px 0 14px; }
.learn-person .pick, .bulk .pick { width: 18px; height: 18px; accent-color: var(--brand); flex: none; }
.clamp { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.45; }
.bulk { border: 1.5px solid var(--brand); }
