/* UEH palette: xanh ngọc (teal) #005F69, cam #F26F33 */
:root {
  --ueh-teal: #005F69;
  --ueh-teal-dark: #00454D;
  --ueh-teal-light: #E6F2F3;
  --ueh-orange: #F26F33;
  --ueh-orange-dark: #D9591F;
  --bg: #F4F7F8;
  --surface: #FFFFFF;
  --text: #1C2B2D;
  --muted: #5F7275;
  --border: #DCE5E6;
  --ok: #1E8E5A; --ok-bg: #E3F5EC;
  --err: #C62828; --err-bg: #FDECEC;
  --warn: #B26A00; --warn-bg: #FFF4E0;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 2px 8px rgba(0,69,77,.06);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; font-size: 15px; line-height: 1.5;
  color: var(--text); background: var(--bg); min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--ueh-teal); }
h1 { font-size: 1.6rem; margin: 0 0 .25rem; color: var(--ueh-teal-dark); }
h2 { font-size: 1.1rem; margin: 0 0 1rem; color: var(--ueh-teal-dark); }
.muted { color: var(--muted); } .small { font-size: .85rem; } .mono { font-family: Consolas, monospace; font-size: .85rem; }
.right { text-align: right; }

/* Top bar */
.topbar { background: var(--ueh-teal); color: #fff; border-bottom: 4px solid var(--ueh-orange); }
.topbar-inner { max-width: 1200px; margin: 0 auto; padding: .6rem 16px; display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: .6rem; color: #fff; text-decoration: none; font-size: 1.05rem; }
.brand img { display: block; height: 42px; width: auto; }
.brand-name { font-size: 1.35rem; font-weight: 700; letter-spacing: .02em; padding-left: .75rem; border-left: 1px solid rgba(255,255,255,.35); line-height: 1.2; }
.nav { display: flex; gap: .25rem; flex: 1; flex-wrap: nowrap; align-items: center; min-width: 0; }
.nav a { color: rgba(255,255,255,.85); text-decoration: none; padding: .45rem .8rem; border-radius: 6px; font-weight: 500; white-space: nowrap; }
.nav a:hover { background: rgba(255,255,255,.1); color: #fff; }
.nav a.active { background: rgba(255,255,255,.16); color: #fff; box-shadow: inset 0 -3px 0 var(--ueh-orange); }
/* Menu thả "Công việc" + menu tài khoản */
.navdd, .who { position: relative; }
.navdd > summary, .who > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: .35rem; border-radius: 6px; color: rgba(255,255,255,.85); }
.navdd > summary::-webkit-details-marker, .who > summary::-webkit-details-marker { display: none; }
.navdd > summary { padding: .45rem .7rem .45rem .8rem; font-weight: 500; white-space: nowrap; }
.navdd > summary:hover, .navdd[open] > summary, .who > summary:hover, .who[open] > summary { background: rgba(255,255,255,.1); color: #fff; }
.navdd.active > summary { background: rgba(255,255,255,.16); color: #fff; box-shadow: inset 0 -3px 0 var(--ueh-orange); }
.navdd > summary:focus-visible, .who > summary:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.dd-chev { transition: transform .2s; opacity: .8; }
.navdd[open] .dd-chev, .who[open] .dd-chev { transform: rotate(180deg); }
.navdd-menu, .who-menu { position: absolute; top: calc(100% + 8px); z-index: 50; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 8px 28px rgba(0,69,77,.18); padding: .4rem; }
.navdd-menu { left: 0; min-width: 300px; }
.nav .navdd-menu a { display: flex; gap: .7rem; align-items: flex-start; padding: .6rem .7rem; border-radius: 8px; color: var(--text); text-decoration: none; white-space: normal; font-weight: 400; }
.navdd-menu a > span { font-size: 1.15rem; line-height: 1.3; }
.navdd-menu a b { display: flex; flex-direction: column; font-weight: 600; font-size: .94rem; }
.navdd-menu a small { font-weight: 400; color: var(--muted); font-size: .78rem; }
.nav .navdd-menu a:hover, .nav .navdd-menu a:focus-visible { background: var(--ueh-teal-light); color: var(--ueh-teal-dark); outline: none; }
.navdd-menu a.on b { color: var(--ueh-teal); }
.nav .nav-flat { display: none; }
.who > summary { padding: .25rem .4rem .25rem .25rem; }
.who-menu { right: 0; min-width: 250px; }
.who-head { display: flex; gap: .6rem; align-items: center; padding: .5rem .6rem .7rem; border-bottom: 1px solid var(--border); margin-bottom: .3rem; color: #fff; }
.who-head .who-name { color: var(--text); }
.who-head .who-name small { color: var(--muted); opacity: 1; }
.who-menu a, .who-out { display: flex; align-items: center; gap: .6rem; width: 100%; padding: .5rem .65rem; border-radius: 6px; color: var(--text); text-decoration: none; font-size: .92rem; background: none; border: 0; cursor: pointer; font: inherit; text-align: left; }
.who-menu a span, .who-out span { width: 1.3rem; text-align: center; }
.who-menu a:hover, .who-out:hover, .who-menu a:focus-visible, .who-out:focus-visible { background: var(--ueh-teal-light); color: var(--ueh-teal-dark); outline: none; }
.who-out { color: var(--bad-text, #b3261e); }
.who-menu form { margin: 0; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--ueh-orange); display: grid; place-items: center; font-weight: 700; }
.who-name { display: flex; flex-direction: column; line-height: 1.25; font-size: .92rem; font-weight: 600; min-width: 0; }
.who-name small { font-weight: 400; }
.who-name small { opacity: .75; }

.container { max-width: 1200px; width: 100%; margin: 0 auto; padding: 1.5rem 16px 2rem; flex: 1; }
.page-head { margin-bottom: 1.25rem; }
.page-head p { margin: 0; }
.footer { text-align: center; padding: 1rem; color: var(--muted); font-size: .85rem; border-top: 1px solid var(--border); background: var(--surface); }

/* Cards & grids */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1.25rem; box-shadow: var(--shadow); }
.grid { display: grid; gap: 1rem; }
.grid.stats { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-bottom: 1.25rem; }
.grid.servers { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.stat { background: var(--surface); border: 1px solid var(--border); border-left: 5px solid var(--ueh-teal); border-radius: var(--radius); padding: 1rem 1.25rem; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.stat.accent { border-left-color: var(--ueh-orange); }
.stat-num { font-size: 2rem; font-weight: 700; color: var(--ueh-teal-dark); font-variant-numeric: tabular-nums; }
.stat-label { color: var(--muted); }
.server { border: 1px solid var(--border); border-radius: 8px; padding: .9rem 1rem; background: var(--ueh-teal-light); }
.server-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: .25rem; }

/* Badges */
.badge { display: inline-block; padding: .15rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-err { background: var(--err-bg); color: var(--err); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-accent { background: #FDEBE2; color: var(--ueh-orange-dark); }
.badge-neutral { background: var(--ueh-teal-light); color: var(--ueh-teal); }

/* Alerts */
.alert { padding: .75rem 1rem; border-radius: 8px; margin-bottom: 1rem; border: 1px solid transparent; }
.alert-success { background: var(--ok-bg); color: var(--ok); border-color: #BFE6D2; }
.alert-warn { background: #FFF6E0; color: #7A5200; border-color: #F2D48A; }
.alert-error { background: var(--err-bg); color: var(--err); border-color: #F5C2C2; }

/* Forms */
label { display: flex; flex-direction: column; gap: .3rem; font-weight: 600; font-size: .9rem; color: var(--text); }
input, select { font: inherit; padding: .6rem .75rem; border: 1px solid var(--border); border-radius: 8px; background: #fff; color: var(--text); font-weight: 400; min-width: 0; }
input:focus, select:focus { outline: none; border-color: var(--ueh-teal); box-shadow: 0 0 0 3px rgba(0,95,105,.15); }
.form { display: flex; flex-direction: column; gap: .9rem; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .9rem; align-items: end; }
.form-actions { display: flex; }

/* Buttons */
.btn { font: inherit; font-weight: 600; border: 1px solid transparent; border-radius: 8px; padding: .6rem 1.1rem; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; transition: background .15s, border-color .15s; }
.btn-primary { background: var(--ueh-orange); color: #fff; }
.btn-primary:hover { background: var(--ueh-orange-dark); }
.btn-outline { background: #fff; color: var(--ueh-teal); border-color: var(--border); }
.btn-outline:hover { border-color: var(--ueh-teal); }
.btn-danger { background: #fff; color: var(--err); border-color: #F0C4C4; }
.btn-danger:hover { background: var(--err-bg); }
.btn-ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.4); }
.btn-ghost:hover { background: rgba(255,255,255,.12); }
.btn-sm { padding: .3rem .65rem; font-size: .82rem; }
.btn-block { width: 100%; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .65rem .6rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: #F8FAFA; }
tbody tr:hover { background: #FAFCFC; }
th.right, td.right { text-align: right; }
.actions { white-space: nowrap; }
.actions > form, .actions > details { display: inline-block; margin: 0 0 0 .25rem; }
details.pop { position: relative; }
details.pop summary { list-style: none; }
details.pop summary::-webkit-details-marker { display: none; }
.pop-body { position: absolute; right: 0; top: calc(100% + 4px); z-index: 10; background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: .6rem; display: flex; gap: .4rem; box-shadow: 0 6px 20px rgba(0,0,0,.12); }
.pop-body input { width: 180px; padding: .35rem .6rem; }

dl.info { display: grid; grid-template-columns: 140px 1fr; gap: .5rem 1rem; margin: 0; }
dl.info dt { color: var(--muted); } dl.info dd { margin: 0; font-weight: 600; }

/* Login */
.login-page { justify-content: center; align-items: center; padding: 16px;
  background: linear-gradient(135deg, var(--ueh-teal-dark) 0%, var(--ueh-teal) 60%, #0A7A86 100%); }
.login-card { width: 100%; max-width: 400px; background: #fff; border-radius: 14px; overflow: hidden; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.login-body { padding: 1.5rem 2rem 2rem; }
.login-card h1 { font-size: 1.3rem; margin: 0 0 1rem; }
.login-card form { display: flex; flex-direction: column; gap: 1rem; }
.login-card .btn { margin-top: .25rem; padding: .75rem; }
.login-brand { display: flex; align-items: center; gap: 1rem; padding: 1.4rem 2rem; background: var(--ueh-teal); color: #fff; border-bottom: 4px solid var(--ueh-orange); }
.login-brand img { display: block; height: 56px; width: auto; }
.login-brand .brand-name { font-size: 1.6rem; padding-left: 1rem; }
.btn-ueh { padding: .8rem; font-size: 1rem; }
.center { text-align: center; margin: .6rem 0 0; }
.local-login { margin-top: 1.25rem; border-top: 1px solid var(--border); padding-top: 1rem; }
.local-login summary { cursor: pointer; color: var(--muted); font-size: .88rem; font-weight: 600; }
.local-login summary:hover { color: var(--ueh-teal); }
.local-login[open] summary { margin-bottom: 1rem; }
.login-foot { color: rgba(255,255,255,.75); font-size: .82rem; margin-top: 1.25rem; text-align: center; }

@media (max-width: 720px) {
  .topbar-inner { gap: .6rem; }
  .brand img { height: 34px; }
  .brand-name { font-size: 1.1rem; padding-left: .6rem; }
  .nav { order: 3; flex-basis: 100%; }
  dl.info { grid-template-columns: 1fr; }
}

/* Ký nhanh */
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.card-head h2 { margin: 0; }
.count { display: inline-block; min-width: 1.6em; padding: 0 .45em; border-radius: 999px; background: var(--ueh-orange); color: #fff; font-size: .85rem; text-align: center; vertical-align: middle; }
.notice { border-left: 5px solid var(--ueh-orange); }
.notice p { margin: 0; }
.empty { text-align: center; padding: 2rem 1rem; }
.empty p { margin: .25rem 0; }
.empty-icon { width: 52px; height: 52px; margin: 0 auto .75rem; border-radius: 50%; background: var(--ok-bg); color: var(--ok); display: grid; place-items: center; font-size: 1.6rem; font-weight: 700; }
.sign-table td { vertical-align: top; }
.sign-table tbody tr { cursor: pointer; }
.sign-table tbody tr:has(.chk-item:checked) { background: #FFF5EF; }
th.chk, td.chk { width: 36px; text-align: center; }
.chk input { width: 18px; height: 18px; accent-color: var(--ueh-orange); cursor: pointer; }
.doc-title { font-weight: 600; color: var(--text); }
.doc-meta { display: flex; flex-wrap: wrap; gap: .25rem .6rem; align-items: center; font-size: .82rem; color: var(--muted); margin-top: .2rem; }
.files a { display: block; font-size: .85rem; text-decoration: none; white-space: nowrap; }
.files a:hover { text-decoration: underline; }
.nowrap { white-space: nowrap; }
.pager { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; justify-content: space-between; margin: 1rem 0 0; }
.pager-nums { display: flex; flex-wrap: wrap; gap: .25rem; }
.pg { min-width: 2.1rem; height: 2.1rem; display: inline-grid; place-items: center; padding: 0 .5rem; border: 1px solid var(--border); border-radius: 6px;
  text-decoration: none; color: var(--text); font-weight: 600; font-size: .9rem; background: var(--surface); }
a.pg:hover { border-color: var(--ueh-teal); color: var(--ueh-teal); }
a.pg:focus-visible { outline: 2px solid var(--ueh-teal); outline-offset: 1px; }
.pg.on { background: var(--ueh-teal); border-color: var(--ueh-teal); color: #fff; }
.pg.off { color: #B5C2C4; } .pg.gap { border: 0; background: none; min-width: 1rem; color: var(--muted); }
.sign-bar { position: sticky; bottom: 0; z-index: 5; display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin: 1rem -1.25rem 0; padding: .9rem 1.25rem; background: #fff; border-top: 2px solid var(--ueh-orange); box-shadow: 0 -4px 12px rgba(0,0,0,.06); }
.sign-bar input { flex: 1; min-width: 200px; }
.sel-count { color: var(--muted); }
.sel-count strong { color: var(--ueh-orange-dark); font-size: 1.1rem; }
.result-list { list-style: none; margin: 0; padding: 0; }
.result-list li { padding: .4rem 0; border-bottom: 1px solid var(--border); }
.stat a { color: inherit; text-decoration: none; display: flex; flex-direction: column; }
.stat-link { font-size: .85rem; color: var(--ueh-orange-dark); font-weight: 600; margin-top: .25rem; }
@media (max-width: 720px) {
  .sign-bar .btn { flex: 1; }
}
.pop-body.pop-left { right: auto; left: 0; }
.pop-left input { width: 240px; }

/* Cấu hình */
.settings-grid { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); align-items: start; }
@media (max-width: 900px) { .settings-grid { grid-template-columns: 1fr; } }
h3 { font-size: .95rem; margin: 1.25rem 0 .6rem; color: var(--ueh-teal-dark); }
.hint { font-weight: 400; font-size: .8rem; color: var(--muted); }
label.check { flex-direction: row; align-items: center; gap: .5rem; font-weight: 400; }
label.check input { width: 16px; height: 16px; accent-color: var(--ueh-orange); }
.btn-row { display: flex; flex-wrap: wrap; gap: .5rem; }
.btn-row form { margin: 0; }
.btn-row.sep { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.err-text { color: var(--err); font-weight: 400; }
.memo { margin-top: .2rem; }
.files a { overflow: hidden; text-overflow: ellipsis; max-width: 280px; }
@media (max-width: 720px) {
  /* 3) Menu trên mobile: 1 hàng, cuộn ngang */
  .nav { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { white-space: nowrap; }
  /* 2) Bảng ký nhanh trên mobile: mỗi hồ sơ là 1 khối, tệp nằm dưới tiêu đề */
  /* Tiêu đề bảng thành thanh "Chọn tất cả" (các cột khác ẩn) */
  .sign-table thead { display: block; }
  .sign-table thead tr { display: block; border-bottom: 2px solid var(--border); background: var(--ueh-teal-light); border-radius: 8px 8px 0 0; }
  .sign-table thead th { display: none; }
  .sign-table thead th.chk { display: block; padding: .6rem .6rem; width: auto; text-align: left; }
  .chk-all-lbl { cursor: pointer; }
  .chk-all-lbl .chk-all-text { display: inline; }
  .sign-table tbody tr { display: grid; grid-template-columns: 36px minmax(0, 1fr); border-bottom: 1px solid var(--border); padding: .5rem 0; }
  .sign-table td { border: 0; padding: .2rem .35rem; }
  .sign-table td.chk { grid-row: span 2; padding-top: .35rem; }
  .sign-table td.files a { max-width: 100%; }
}

/* Chi tiết lỗi ký */
[hidden] { display: none !important; }
.result-card h2 { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.result-card.has-fail { border-left: 5px solid var(--err); }
.fail-item { border: 1px solid #F3CACA; background: #FFF8F8; border-radius: 8px; padding: .9rem 1rem; margin-bottom: .75rem; }
.fail-head { display: flex; gap: .75rem; align-items: flex-start; }
.fail-head > div { flex: 1; min-width: 0; }
.fail-icon { flex: 0 0 26px; height: 26px; border-radius: 50%; background: var(--err); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .85rem; }
.fail-title { font-weight: 600; }
.fail-reason { color: var(--err); font-weight: 600; font-size: .92rem; }
.err-dl { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: .35rem 1rem; margin: .75rem 0 0; font-size: .88rem; }
.err-dl dt { color: var(--muted); }
.err-dl dd { margin: 0; overflow-wrap: anywhere; }
.err-dl dd.strong { font-weight: 600; color: var(--err); }
.err-dl dd.hint { background: var(--warn-bg); color: #6B4400; padding: .35rem .6rem; border-radius: 6px; }
.ok-list { margin-top: .5rem; }
.err-details summary { cursor: pointer; list-style: none; }
.err-details summary::-webkit-details-marker { display: none; }
.err-details summary::after { content: ' ▾'; color: var(--muted); font-size: .8rem; }
.err-details[open] summary::after { content: ' ▴'; }
.err-details .err-dl { background: #FFF8F8; border: 1px solid #F3CACA; border-radius: 8px; padding: .6rem .75rem; min-width: 320px; }

/* Tóm tắt AI */
.btn-ai { margin-top: .5rem; background: #F2F0FF; color: #4B3BB5; border-color: #DDD8FF; }
.btn-ai:hover { background: #E7E3FF; }
.btn-ai[aria-expanded="true"] { background: #4B3BB5; color: #fff; }
tr.ai-row > td { background: #FBFAFF; border-bottom: 1px solid var(--border); padding: 0; }
.ai-panel { padding: 1rem 1.25rem 1rem 3rem; max-width: 980px; }
.ai-loading { display: flex; align-items: center; gap: .6rem; color: #4B3BB5; font-size: .9rem; }
.spinner { width: 16px; height: 16px; border: 2px solid #DDD8FF; border-top-color: #4B3BB5; border-radius: 50%; animation: spin .8s linear infinite; flex: 0 0 16px; }
@keyframes spin { to { transform: rotate(360deg); } }
.ai-error { color: var(--err); background: var(--err-bg); padding: .6rem .8rem; border-radius: 8px; font-size: .9rem; }
.ai-money { border: 2px solid var(--ueh-orange); border-radius: 10px; background: #FFF7F2; padding: .8rem 1rem; margin-bottom: 1rem; }
.ai-money-head { font-weight: 700; color: var(--ueh-orange-dark); margin-bottom: .5rem; }
.ai-total { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: .5rem; padding: .5rem .75rem; background: #fff; border-radius: 8px; margin-bottom: .5rem; }
.ai-total span { color: var(--muted); font-size: .88rem; }
.ai-total strong { font-size: 1.25rem; color: var(--ueh-orange-dark); font-variant-numeric: tabular-nums; }
.ai-money-table { width: 100%; font-size: .9rem; }
.ai-money-table td { padding: .4rem .5rem; border-bottom: 1px dashed #F5C9B3; vertical-align: top; }
.ai-money-table tr:last-child td { border-bottom: 0; }
.ai-money-table td.money { text-align: right; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ai-type { display: inline-block; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: #4B3BB5; background: #F2F0FF; padding: .15rem .55rem; border-radius: 999px; margin-bottom: .4rem; }
.ai-text { margin: .25rem 0 .75rem; line-height: 1.6; }
.ai-sec h4 { margin: .75rem 0 .3rem; font-size: .9rem; color: var(--ueh-teal-dark); }
.ai-sec ul { margin: 0; padding-left: 1.2rem; }
.ai-sec li { margin: .15rem 0; }
.ai-sec p { margin: 0; }
.ai-warn { background: var(--warn-bg); border-radius: 8px; padding: .1rem .8rem .6rem; margin-top: .75rem; }
.ai-warn h4 { color: var(--warn); }
.ai-skip { font-size: .85rem; color: var(--muted); margin-top: .75rem; }
.ai-skip ul { margin: .25rem 0 0; padding-left: 1.2rem; }
.ai-foot { font-size: .78rem; color: var(--muted); margin-top: .9rem; padding-top: .6rem; border-top: 1px solid var(--border); }
.ai-actions { margin-top: .6rem; }
@media (max-width: 720px) {
  .err-dl { grid-template-columns: 1fr; gap: .1rem; }
  .err-dl dd { margin-bottom: .4rem; }
  .err-details .err-dl { min-width: 0; }
  .sign-table tbody tr.ai-row { display: block; padding: 0; }
  .sign-table tbody tr.ai-row > td { display: block; }
  .sign-table tbody tr.flow-row { display: block; padding: 0; }
  .sign-table tbody tr.flow-row > td { display: block; }
  .ai-panel { padding: .9rem; }
  .fail-head { flex-wrap: wrap; }
}
.ai-money-table td:first-child { width: 58%; }
.ai-money-table td.money { white-space: normal; text-align: right; }

/* Cột tóm tắt AI ngắn */
.sign-table th.col-doc { width: 36%; }
.sign-table th.col-ai { width: 40%; color: #4B3BB5; }
.sign-table th.col-files { width: 24%; }
td.ai-short { font-size: .86rem; line-height: 1.5; background: #FCFBFF; border-left: 3px solid #E7E3FF; }
.ai-short-money { background: #FFF3EA; border-radius: 6px; padding: .2rem .45rem; margin-bottom: .3rem; color: #8A3A0E; }
.ai-short-money b { color: var(--ueh-orange-dark); }
.ai-short-line b { color: #4B3BB5; }
.ai-short-wait { display: inline-flex; gap: .4rem; align-items: center; color: #4B3BB5; font-size: .82rem; }
.ai-short-err { color: var(--muted); font-size: .8rem; font-style: italic; }
@media (max-width: 720px) {
  .sign-table td.ai-short { grid-column: 2; border-left: 3px solid #E7E3FF; margin: .2rem 0; }
  .sign-table td.chk { grid-row: span 3; }
}

textarea { font: inherit; padding: .6rem .75rem; border: 1px solid var(--border); border-radius: 8px; background: #fff; color: var(--text); font-weight: 400; resize: vertical; }
textarea:focus { outline: none; border-color: var(--ueh-teal); box-shadow: 0 0 0 3px rgba(0,95,105,.15); }
.prompt-box { font-family: Consolas, monospace; font-size: .84rem; line-height: 1.5; min-height: 220px; }

/* Chi phí AI — biểu đồ cột 1 chuỗi */
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg a { padding: .3rem .75rem; font-size: .85rem; text-decoration: none; color: var(--muted); }
.seg a.on { background: var(--ueh-teal); color: #fff; }
.chart { position: relative; height: 240px; margin: .5rem 0 2rem 3.5rem; }
.chart-grid { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; }
.chart-grid .gl { border-top: 1px solid #EDF1F2; height: 0; position: relative; }
.chart-grid .gl:last-child { border-top-color: #C9D3D5; }
.chart-grid .gl span { position: absolute; right: calc(100% + .5rem); top: -.55rem; font-size: .72rem; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.bars { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(var(--n), 1fr); align-items: end; }
.bar-slot { height: 100%; display: flex; align-items: flex-end; padding: 0 1px; cursor: default; outline: none; }
.bar { width: 100%; max-width: 28px; margin: 0 auto; background: var(--ueh-teal); border-radius: 4px 4px 0 0; }
.bar-slot.hl .bar, .bar-slot:hover .bar { background: var(--ueh-teal-dark); }
.bar-slot.hl { background: rgba(0,95,105,.06); }
.xlabels { position: absolute; left: 0; right: 0; top: calc(100% + .35rem); display: grid; grid-template-columns: repeat(var(--n), 1fr); font-size: .72rem; color: var(--muted); }
.xlabels span { text-align: center; white-space: nowrap; overflow: visible; }
.chart-tip { position: absolute; top: -.5rem; transform: translateY(-100%); background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: .45rem .65rem; box-shadow: 0 6px 18px rgba(0,0,0,.12); font-size: .82rem; pointer-events: none; z-index: 3; min-width: 150px; }
.tip-d { color: var(--muted); font-size: .76rem; } .tip-v { font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; } .tip-n { color: var(--muted); font-size: .76rem; }
.table-view { margin-top: .5rem; } .table-view summary { cursor: pointer; color: var(--ueh-teal); font-size: .88rem; font-weight: 600; }
td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---- ⚙ Cài đặt: nút bánh răng + menu thả xuống ---- */
.gear { position: relative; }
.gear > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: .4rem; padding: .4rem .7rem;
  border-radius: 6px; color: rgba(255,255,255,.9); font-weight: 500; user-select: none; }
.gear > summary::-webkit-details-marker { display: none; }
.gear > summary:hover, .gear[open] > summary { background: rgba(255,255,255,.12); color: #fff; }
.gear.active > summary { background: rgba(255,255,255,.16); box-shadow: inset 0 -3px 0 var(--ueh-orange); color: #fff; }
.gear > summary:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.gear[open] .gear-ico { transform: rotate(60deg); } .gear-ico { transition: transform .25s; }
.gear-menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 50; min-width: 270px; background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 8px 28px rgba(0,69,77,.18); padding: .4rem; }
.gear-menu a { display: flex; align-items: center; gap: .6rem; padding: .5rem .65rem; border-radius: 6px; color: var(--text); text-decoration: none; font-size: .92rem; }
.gear-menu a span { width: 1.3rem; text-align: center; }
.gear-menu a:hover, .gear-menu a:focus-visible { background: var(--ueh-teal-light); color: var(--ueh-teal-dark); outline: none; }
.gear-menu a.on { color: var(--ueh-teal); font-weight: 600; }
.gear-sec { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: .55rem .65rem .2rem; }
.gear-sec + a { margin-top: 0; } .gear-menu a + .gear-sec { border-top: 1px solid var(--border); margin-top: .35rem; }
@media (max-width: 1100px) { .gear-label { display: none; } }
@media (max-width: 720px) { .gear-menu, .who-menu { position: fixed; left: 16px; right: 16px; top: 64px; min-width: 0; } .nav .navdd { display: none; } .nav .nav-flat { display: inline-block; } }

/* Thanh tab chung cho các trang cài đặt */
.set-tabs { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem; margin: -.25rem 0 1.25rem; padding-bottom: .5rem; border-bottom: 1px solid var(--border); }
.set-tabs-title { font-weight: 700; color: var(--ueh-teal-dark); margin-right: .75rem; }
.set-tabs a { padding: .4rem .8rem; border-radius: 6px; text-decoration: none; color: var(--muted); font-weight: 500; }
.set-tabs a:hover { background: var(--ueh-teal-light); color: var(--ueh-teal-dark); }
.set-tabs a.on { background: var(--ueh-teal); color: #fff; }
.jump { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .5rem; }
.jump a { font-size: .85rem; padding: .2rem .65rem; border: 1px solid var(--border); border-radius: 999px; text-decoration: none; background: var(--surface); }
.jump a:hover { border-color: var(--ueh-teal); }
.settings-grid { scroll-margin-top: 1rem; }

/* ---- Luồng trình ký ---- */
.flow { margin-top: .4rem; font-size: .78rem; line-height: 1.6; }
.fl-label { margin-right: .4rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-size: .68rem; }
.fl-loading { display: inline-flex; align-items: center; gap: .35rem; color: var(--muted); }
.fl-loading .spinner { width: 11px; height: 11px; flex-basis: 11px; }
.fl-btn { all: unset; cursor: pointer; display: inline; border-radius: 4px; padding: .1rem .2rem; }
.fl-btn:hover { background: var(--ueh-teal-light); }
.fl-btn:focus-visible { outline: 2px solid var(--ueh-teal); outline-offset: 1px; }
.fl-chain { display: inline; }
.fl-step { white-space: nowrap; color: var(--text); }
.fl-step i, .fl-act i { font-style: normal; font-weight: 700; margin-right: .2rem; }
.fl-ok i { color: var(--ok); } .fl-warn i { color: var(--warn); } .fl-err i { color: var(--err); } .fl-info i { color: var(--ueh-teal); } .fl-muted, .fl-muted i { color: var(--muted); }
.fl-step.fl-me { color: var(--ueh-orange-dark); font-weight: 700; } .fl-me i { color: var(--ueh-orange); }
.fl-arrow { color: #9AABAD; margin: 0 .3rem; }
.fl-toggle { color: var(--ueh-teal); font-weight: 600; white-space: nowrap; margin-left: .6rem; }
.fl-toggle::after { content: ' ▾'; }
.fl-btn[aria-expanded="true"] .fl-toggle::after { content: ' ▴'; }
tr.flow-row > td { background: #FAFCFC; border-top: 0; padding: .25rem .75rem .75rem 2.6rem; }
.flow-detail { max-width: 760px; display: grid; gap: .4rem; }
.fl-round { border: 1px solid var(--border); border-radius: 8px; background: var(--surface); overflow: hidden; }
.fl-rhead { display: flex; flex-wrap: wrap; align-items: center; gap: .2rem .75rem; padding: .4rem .65rem; font-size: .8rem; background: #F2F6F7; }
details.fl-round > summary { cursor: pointer; list-style: none; }
details.fl-round > summary::-webkit-details-marker { display: none; }
details.fl-round > summary strong::before { content: '▸ '; color: var(--muted); }
details.fl-round[open] > summary strong::before { content: '▾ '; }
.fl-badge { margin-left: auto; font-size: .72rem; font-weight: 600; padding: .05rem .5rem; border-radius: 999px; background: var(--ueh-teal-light); color: var(--muted); }
.fl-badge.fl-warn { background: var(--warn-bg); color: var(--warn); } .fl-badge.fl-err { background: var(--err-bg); color: var(--err); }
.fl-badge.fl-me { background: var(--ueh-orange); color: #fff; }
.fl-table { width: 100%; border-collapse: collapse; font-size: .8rem; }
.fl-table th { text-align: left; font-weight: 600; color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .03em; padding: .3rem .65rem; border-bottom: 1px solid var(--border); background: none; }
.fl-table td { padding: .28rem .65rem; border-bottom: 1px solid #EEF3F3; vertical-align: top; }
.fl-table tr:last-child td { border-bottom: 0; }
.fl-table .fl-n { width: 1.5rem; color: var(--muted); text-align: right; padding-right: 0; }
.fl-table .fl-t { white-space: nowrap; color: var(--muted); font-variant-numeric: tabular-nums; width: 6.5rem; }
.fl-act.fl-warn { color: var(--warn); } .fl-act.fl-err { color: var(--err); } .fl-act.fl-me { color: var(--ueh-orange-dark); font-weight: 600; }
.fl-now td { background: #FFF6F1; }
.fl-note { margin: 0; font-size: .74rem; color: var(--muted); }
@media (max-width: 720px) {
  .fl-label { display: block; }
  tr.flow-row > td { padding: .25rem .5rem .6rem; }
  .fl-table .fl-n { display: none; }
}
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@media (max-width: 720px) { .fl-timeline .fl-when { flex-basis: 100%; } }

/* Lịch chạy tóm tắt ngắn */
fieldset.sched { border: 1px solid var(--border); border-radius: 8px; padding: .6rem .9rem .4rem; margin: 0; display: grid; gap: .6rem; min-width: 0; }
fieldset.sched legend { font-weight: 600; color: var(--ueh-teal-dark); padding: 0 .3rem; }
.sched-row { display: flex; flex-wrap: wrap; gap: .75rem; }
.sched-row label { flex: 1 1 130px; }
.sched select, .sched input[type=time] { width: 100%; }
.days { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; }
.days .muted { margin-right: .35rem; }
.day { position: relative; margin: 0; }
.day input { position: absolute; opacity: 0; inset: 0; cursor: pointer; margin: 0; }
.day span { display: inline-block; min-width: 2.4rem; text-align: center; padding: .25rem .5rem; border: 1px solid var(--border); border-radius: 6px; font-size: .85rem; font-weight: 600; color: var(--muted); background: var(--surface); }
.day input:checked + span { background: var(--ueh-teal); border-color: var(--ueh-teal); color: #fff; }
.day input:focus-visible + span { outline: 2px solid var(--ueh-orange); outline-offset: 1px; }

/* Chỉ số UEH (trang chủ) */
.rk-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: .75rem; }
.rk-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.rk-card { padding: 0; overflow: hidden; position: relative; }
.rk-card iframe { display: block; width: 100%; border: 0; }
.rk-loading { position: absolute; top: 1.25rem; left: 1.25rem; display: flex; align-items: center; gap: .5rem; color: var(--muted); font-size: .9rem; }
.rk-loading[hidden] { display: none; }
@media (max-width: 720px) { .rk-card { margin: 0 -16px; border-radius: 0; border-left: 0; border-right: 0; } }

/* Email nhắc ký duyệt — trang đích /mail.php */
.alert-info { background: var(--ueh-teal-light); color: var(--ueh-teal-dark); border-color: #BFDDE0; }
.btn-lg { padding: .9rem 1.2rem; font-size: 1.05rem; }
.btn[disabled] { opacity: .75; cursor: progress; }
.mail-wrap { max-width: 760px; margin: 0 auto; }
.mail-hero { border-top: 4px solid var(--ueh-orange); }
.mh-head { display: flex; gap: .9rem; align-items: flex-start; margin-bottom: .75rem; }
.mh-head h1 { font-size: 1.35rem; margin: 0; }
.mh-head p { margin: .15rem 0 0; }
.mh-ico { flex: 0 0 46px; height: 46px; border-radius: 12px; background: var(--ueh-teal-light); color: var(--ueh-teal); display: grid; place-items: center; font-size: 1.4rem; }
.mh-stats { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .9rem; }
.mh-form { margin: .25rem 0 .75rem; }
.mh-form label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .6rem; }
.mh-form textarea { width: 100%; margin-top: .3rem; font: inherit; padding: .55rem .7rem; border: 1px solid var(--border); border-radius: 8px; resize: vertical; }
.mh-note { margin: .6rem 0 0; }
.mail-list { display: grid; gap: .7rem; margin-top: 1rem; }
.mcard { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--ueh-teal); border-radius: var(--radius); padding: .85rem 1rem; box-shadow: var(--shadow); }
.mcard.is-new { border-left-color: var(--ueh-orange); }
.mcard.is-done { opacity: .62; border-left-color: var(--ok); }
.mcard-top { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .3rem; }
.mcard-top:empty { display: none; }
.mcard-title { font-size: 1rem; margin: 0; line-height: 1.4; color: var(--text); }
.mcard-ai { margin-top: .5rem; display: grid; gap: .3rem; }
.mail-err-ico { width: 56px; height: 56px; margin: 0 auto .5rem; border-radius: 50%; background: var(--warn-bg); color: var(--warn); display: grid; place-items: center; font-size: 1.6rem; }
.login-body h1 + p { margin-top: .4rem; }

/* Cài đặt — email nhắc */
.ph-help { margin: -.25rem 0 1rem; }
.ph-help summary { cursor: pointer; font-weight: 600; font-size: .88rem; color: var(--ueh-teal); }
.ph-table { width: 100%; border-collapse: collapse; margin-top: .5rem; font-size: .85rem; }
.ph-table td { padding: .3rem .4rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.ph-table td:last-child { text-align: right; width: 1%; }
.ph-table code { white-space: nowrap; }
.dg-twice { align-self: end; padding-bottom: .55rem; }
.dg-table td, .dg-table th { padding: .4rem .5rem; }
.nowrap { white-space: nowrap; }

/* Tài khoản — thiết bị */
.dev-list { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: .5rem; }
.dev-list li { display: flex; gap: .7rem; align-items: flex-start; padding: .6rem .75rem; border: 1px solid var(--border); border-radius: 8px; }
.dev-list li.is-me { border-color: #BFE6D2; background: #F6FCF9; }
.dev-ico { font-size: 1.3rem; line-height: 1.2; }

@media (max-width: 720px) {
  .mh-head h1 { font-size: 1.15rem; }
  .mh-ico { flex-basis: 40px; height: 40px; font-size: 1.2rem; }
  .mcard { padding: .75rem .8rem; }
  .ph-table td:first-child { width: 40%; }
}
label > .badge { align-self: flex-start; }
.card-head + .btn-row + dl.info, .btn-row + dl.info { margin-top: .9rem; }

/* Nhật ký email (admin) */
.elog-filter { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: 1rem; }
.elog-filter input[type=search] { flex: 1 1 220px; min-width: 0; }
.elog-filter select { flex: 0 1 auto; }
.elog-list { display: flex; flex-direction: column; border-top: 1px solid var(--border); }
.elog-row { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr) auto; gap: .35rem 1rem; align-items: center; padding: .7rem .25rem; border-bottom: 1px solid var(--border); color: inherit; text-decoration: none; }
.elog-row:hover, .elog-row:focus-visible { background: var(--ueh-teal-light); }
.elog-main { display: flex; flex-direction: column; min-width: 0; }
.elog-subj { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.elog-tags { display: flex; gap: .3rem; flex-wrap: wrap; justify-content: flex-end; }
.elog-when { color: var(--muted); }
.elog-head { display: flex; flex-direction: column; align-items: flex-start; gap: .4rem; }
.elog-head h1 { overflow-wrap: anywhere; }
.elog-detail { display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.elog-meta dd { overflow-wrap: anywhere; }
.elog-resp { font-size: .8rem; white-space: pre-wrap; word-break: break-all; }
.elog-frame { width: 100%; height: 75vh; min-height: 480px; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
@media (max-width: 860px) {
  .elog-detail { grid-template-columns: 1fr; }
  .elog-row { grid-template-columns: minmax(0, 1fr) auto; }
  .elog-when { grid-column: 1 / -1; order: -1; }
  .elog-frame { height: 70vh; min-height: 420px; }
}
@media (max-width: 520px) {
  .elog-row { grid-template-columns: 1fr; }
  .elog-tags { justify-content: flex-start; }
  .elog-subj { white-space: normal; }
}
@media (max-width: 520px) {
  .elog-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
  .elog-stats .stat { padding: .7rem .9rem; }
}

/* Nhãn "Chọn tất cả" chỉ hiện trên mobile (desktop: chỉ ô chọn ở tiêu đề cột) */
.chk-all-lbl { display: inline-flex; flex-direction: row; align-items: center; gap: .6rem; margin: 0; font-weight: 600; text-transform: none; letter-spacing: normal; font-size: .95rem; color: var(--text, inherit); }
.chk-all-text { display: none; }

/* Lịch sử ký trên điện thoại: mỗi lượt là 1 khối (thời gian · thao tác · kết quả / tên hồ sơ) thay vì bảng 4 cột cuộn ngang */
@media (max-width: 720px) {
  .history-table thead { display: none; }
  .history-table, .history-table tbody { display: block; }
  .history-table tr { display: grid; grid-template-columns: auto auto 1fr; gap: .25rem .6rem; align-items: center; padding: .6rem 0; border-bottom: 1px solid var(--border); }
  .history-table td { border: 0; padding: 0; }
  .history-table td:nth-child(1) { grid-column: 1; color: var(--muted); }
  .history-table td:nth-child(3) { grid-column: 2; font-weight: 600; }
  .history-table td:nth-child(4) { grid-column: 3; justify-self: end; text-align: right; }
  .history-table td:nth-child(2) { grid-column: 1 / -1; grid-row: 2; }
  .history-table .err-details summary .small { display: none; }
  .history-table .err-details[open] { grid-column: 1 / -1; }
}

/* Bản tin công việc */
.bt-picker { padding: 1rem 1.1rem .85rem; background: linear-gradient(180deg, var(--ueh-teal-light) 0, var(--surface) 5.5rem); }
.bt-pick-head { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.bt-arrow { flex: 0 0 auto; width: 2.6rem; height: 2.6rem; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--border); background: var(--surface); color: var(--ueh-teal); text-decoration: none; box-shadow: 0 1px 2px rgba(0,69,77,.08); transition: background .15s, border-color .15s, transform .1s; }
.bt-arrow:hover { background: var(--ueh-teal); border-color: var(--ueh-teal); color: #fff; }
.bt-arrow:active { transform: scale(.94); }
.bt-arrow:focus-visible { outline: 3px solid rgba(0,95,105,.35); outline-offset: 2px; }
.bt-arrow.is-off { opacity: .35; pointer-events: none; box-shadow: none; }
.bt-cur { position: relative; flex: 0 1 auto; min-width: 0; display: flex; flex-direction: row; align-items: center; font-weight: 400; font-size: 1rem; gap: .8rem; padding: .45rem .6rem .45rem 1rem; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); cursor: pointer; box-shadow: 0 1px 2px rgba(0,69,77,.08); transition: border-color .15s, box-shadow .15s; }
.bt-cur:hover, .bt-cur:focus-within { border-color: var(--ueh-teal); box-shadow: 0 0 0 3px rgba(0,95,105,.12); }
.bt-cur-txt { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.bt-cur-rel { font-size: .72rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ueh-orange-dark, #c4500f); }
.bt-cur-date { font-size: 1.12rem; color: var(--ueh-teal-dark); white-space: nowrap; font-variant-numeric: tabular-nums; }
.bt-cal { width: 2.2rem; height: 2.2rem; border-radius: 10px; display: grid; place-items: center; background: var(--ueh-teal-light); color: var(--ueh-teal); flex: 0 0 auto; }
.bt-cur input[type=date] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; margin: 0; }
.bt-cur input[type=date]::-webkit-calendar-picker-indicator { position: absolute; inset: 0; width: 100%; height: 100%; cursor: pointer; }
.bt-jump { margin-left: auto; font-size: .85rem; font-weight: 600; color: var(--ueh-teal); text-decoration: none; padding: .35rem .75rem; border-radius: 999px; border: 1px solid transparent; }
.bt-jump:hover { border-color: var(--ueh-teal); background: var(--surface); }
.bt-days { position: relative; display: flex; gap: .35rem; overflow-x: auto; margin-top: .9rem; padding: .55rem 1rem .35rem; scrollbar-width: thin;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 1rem, #000 calc(100% - 1rem), transparent 100%); mask-image: linear-gradient(90deg, transparent 0, #000 1rem, #000 calc(100% - 1rem), transparent 100%); }
.bt-day { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: .05rem; width: 3.3rem; padding: .4rem .2rem .35rem; border: 1px solid var(--border); border-radius: 12px; text-decoration: none; color: var(--text, inherit); background: var(--surface); position: relative; transition: background .15s, border-color .15s, transform .1s; }
.bt-day:hover { border-color: var(--ueh-teal); transform: translateY(-1px); }
.bt-day.mon:not(:first-child) { margin-left: .55rem; }
.bt-day.mon:not(:first-child)::before { content: ""; position: absolute; left: calc(-.45rem - 1px); top: 18%; bottom: 18%; width: 1px; background: var(--border); }
.bt-day small { color: var(--muted); font-size: .68rem; font-weight: 600; letter-spacing: .02em; }
.bt-day b { font-size: 1.2rem; line-height: 1.1; font-variant-numeric: tabular-nums; color: var(--ueh-teal-dark); }
.bt-day em { font-style: normal; font-size: .62rem; color: var(--muted); }
.bt-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: transparent; margin-top: .15rem; }
.bt-day.has .bt-dot, .bt-dot.is-on { background: var(--ok, #1a7f4b); }
.bt-day.sun small { color: var(--ueh-orange-dark, #c4500f); font-weight: 800; }
.bt-day.on { background: var(--ueh-teal); border-color: var(--ueh-teal); box-shadow: 0 4px 12px rgba(0,95,105,.28); }
.bt-day.on b { color: #fff; }
.bt-day.on small, .bt-day.on em, .bt-day.on.sun small { color: #d7f0f0; }
.bt-day.on.has .bt-dot { background: #8be0b0; }
.bt-wk { position: absolute; top: -.5rem; left: 50%; transform: translateX(-50%); font-style: normal; font-size: .55rem; font-weight: 800; letter-spacing: .04em; background: var(--ueh-orange, #f26f21); color: #fff; padding: 0 .3rem; border-radius: 4px; line-height: 1.4; }
.bt-wk.is-inline { position: static; transform: none; display: inline-block; vertical-align: 1px; }
.bt-legend { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: .45rem; }
.bt-legend > span { display: inline-flex; align-items: center; gap: .35rem; }
.bt-legend .bt-dot { margin: 0; }
@media (max-width: 520px) {
  .bt-picker { padding: .85rem .8rem .75rem; }
  .bt-pick-head { flex-wrap: nowrap; gap: .45rem; }
  .bt-cur { flex: 1 1 auto; justify-content: space-between; padding-left: .8rem; }
  .bt-cur-date { font-size: 1rem; }
  .bt-arrow { width: 2.4rem; height: 2.4rem; }
  .bt-jump { display: none; }
}
.bt-player { display: flex; flex-direction: column; gap: .9rem; }
.bt-title { display: flex; gap: .85rem; align-items: center; }
.bt-title h2 { margin: 0; }
.bt-title p { margin: .15rem 0 0; }
.bt-ico { flex: 0 0 auto; width: 3rem; height: 3rem; border-radius: 50%; display: grid; place-items: center; font-size: 1.5rem; background: var(--ueh-teal-light); }
#bt-audio { width: 100%; }
.bt-controls { display: flex; gap: .6rem; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.bt-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .5rem; }
.bt-stats span { background: var(--bg, #f4f7f7); border: 1px solid var(--border); border-radius: 10px; padding: .55rem .7rem; font-size: .85rem; color: var(--muted); }
.bt-stats b { display: block; font-size: 1.35rem; color: var(--ueh-teal); line-height: 1.2; }
.bt-stats em { font-style: normal; font-size: .78rem; }
.bt-stats .warn b { color: var(--err, #b42318); }
.bt-running { padding: 1rem; border: 1px dashed var(--border); border-radius: 10px; background: var(--ueh-teal-light); font-weight: 600; }
.bt-running p { font-weight: 400; margin: .4rem 0 0; }
.bt-empty p { margin: 0; }
.bt-gen { display: flex; gap: .7rem; align-items: center; flex-wrap: wrap; }
.bt-text { font-size: 1.02rem; line-height: 1.75; max-width: 75ch; }
.bt-text p { margin: 0 0 .9rem; }
.bt-items summary { cursor: pointer; list-style: none; }
.bt-items summary::-webkit-details-marker { display: none; }
.bt-items summary h2 { display: inline; }
.bt-items summary::before { content: "▸ "; color: var(--muted); }
.bt-items[open] summary::before { content: "▾ "; }
.bt-list { list-style: none; margin: .8rem 0 0; padding: 0; }
.bt-list li { padding: .65rem 0; border-top: 1px solid var(--border); }
.bt-li-head { display: flex; gap: .5rem; justify-content: space-between; align-items: flex-start; }
.bt-badges { display: flex; gap: .25rem; flex-wrap: wrap; justify-content: flex-end; flex: 0 0 auto; max-width: 45%; }
.bt-ref { margin-top: .2rem; color: var(--muted); }
.bt-cost { margin-top: -.5rem; }
.bt-adv summary { cursor: pointer; font-weight: 600; font-size: .92rem; }
.bt-sample { width: 100%; margin-top: .5rem; }
@media (max-width: 720px) {
  .bt-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bt-li-head { flex-direction: column; }
  .bt-badges { max-width: none; justify-content: flex-start; }
  .bt-text { font-size: 1rem; }
}

/* Bản tin tuần */
.bt-tabs { display: flex; gap: .5rem; margin: 0 0 1rem; flex-wrap: wrap; }
.bt-tabs a { flex: 1 1 200px; display: flex; flex-direction: column; padding: .65rem 1rem; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); text-decoration: none; color: var(--text, inherit); font-weight: 700; }
.bt-tabs a small { font-weight: 400; color: var(--muted); }
.bt-tabs a.on { border-color: var(--ueh-teal); background: var(--ueh-teal); color: #fff; }
.bt-tabs a.on small { color: #d7f0f0; }
.bt-player.is-week { border-top: 4px solid var(--ueh-orange, #f26f21); }
@media (max-width: 520px) { .bt-tabs a { flex: 1 1 0; padding: .55rem .7rem; font-size: .92rem; } .bt-tabs a small { font-size: .72rem; } }

.bt-player.from-mail { box-shadow: 0 0 0 3px rgba(242,111,51,.45), var(--shadow); animation: bt-glow 2.4s ease-out 1; scroll-margin-top: 1rem; }
@keyframes bt-glow { 0% { box-shadow: 0 0 0 10px rgba(242,111,51,.25); } 100% { box-shadow: 0 0 0 3px rgba(242,111,51,.45); } }
.wm-members { list-style: none; margin: 0; padding: 0; }
.wm-members li { display: flex; gap: .6rem; align-items: center; justify-content: space-between; padding: .55rem 0; border-bottom: 1px solid var(--border); }
.wm-members li > div { min-width: 0; overflow-wrap: anywhere; }
.wm-members form { margin: 0; flex: 0 0 auto; }
.wm-add { display: flex; gap: .5rem; flex-wrap: wrap; align-items: flex-end; margin-top: .9rem; }
.wm-add select, .wm-add input { flex: 1 1 220px; min-width: 0; }
.wm-add select[multiple] { min-height: 8.5rem; }

/* Hộp chọn ngày / tuần: canh giữa (Bản tin công việc + Tổng quan công việc) */
.bt-pick-head { justify-content: center; }
.bt-jump { margin-left: .25rem; }
.bt-day:first-child { margin-left: auto; }
.bt-day:last-child { margin-right: auto; }
.bt-legend { justify-content: center; }

/* Tổng quan công việc */
:root { --s-new: #2a78d6; --s-done: #1baf7a; --s-open: #2a78d6; --s-over: #d03b3b; --s-c1: #2a78d6; --s-c2: #eb6834; --s-c3: #6250d6; --s-c4: #9aa5a7; --good-text: #006300; --bad-text: #b3261e; }
.s-new { --c: var(--s-new); } .s-done { --c: var(--s-done); } .s-open { --c: var(--s-open); } .s-over { --c: var(--s-over); }
.s-c1 { --c: var(--s-c1); } .s-c2 { --c: var(--s-c2); } .s-c3 { --c: var(--s-c3); } .s-c4 { --c: var(--s-c4); }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--c); flex: 0 0 auto; }
.wk-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; }
.wk-refresh { display: flex; gap: .6rem; align-items: center; }
.wk-chip { width: 4.6rem; }
.wk-chip b { font-size: 1rem; }
.wk-partial { text-align: center; color: var(--muted); margin: -.4rem 0 .9rem; }
.wk-kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: .75rem; margin-bottom: 1.25rem; }
.kp { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .85rem 1rem; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.kp-l { display: flex; align-items: center; gap: .4rem; font-size: .8rem; font-weight: 600; color: var(--muted); }
.kp b { font-size: 1.9rem; line-height: 1.15; color: var(--ueh-teal-dark); font-variant-numeric: tabular-nums; }
.kp-d { font-size: .76rem; color: var(--muted); }
.kp-d.is-good { color: var(--good-text); font-weight: 600; }
.kp-d.is-bad { color: var(--bad-text); font-weight: 600; }
.kp-alert { border-top: 3px solid var(--s-over); }
.kp-alert b { color: var(--bad-text); }

.wk-ai { border-top: 4px solid var(--ueh-orange); background: linear-gradient(180deg, #FFF8F3 0, var(--surface) 7rem); }
.wk-ai-head { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; flex-wrap: wrap; }
.wk-ai-head h2 { margin: 0 0 .2rem; }
.wk-overview { font-size: 1.02rem; line-height: 1.7; margin: .9rem 0 1.1rem; padding: .8rem 1rem; background: var(--ueh-teal-light); border-radius: 10px; color: var(--ueh-teal-dark); }
.wk-hl { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: .85rem; }
.wk-hl-card { border: 1px solid var(--border); border-left: 4px solid var(--ueh-teal); border-radius: 12px; padding: .85rem 1rem; background: var(--surface); display: flex; flex-direction: column; gap: .35rem; }
.wk-hl-card.is-key { border-left-color: var(--ueh-orange); box-shadow: 0 2px 10px rgba(242,111,51,.12); }
.wk-hl-top { display: flex; gap: .35rem; align-items: center; flex-wrap: wrap; }
.wk-hl-no { width: 1.6rem; height: 1.6rem; border-radius: 50%; display: grid; place-items: center; font-size: .8rem; font-weight: 800; background: var(--ueh-teal-light); color: var(--ueh-teal-dark); }
.is-key .wk-hl-no { background: var(--ueh-orange); color: #fff; }
.badge-key { background: #FDEBE2; color: var(--ueh-orange-dark); font-weight: 700; }
.wk-area { margin-left: auto; font-size: .74rem; color: var(--muted); font-weight: 600; }
.wk-hl-card h3 { margin: .15rem 0 0; font-size: 1rem; line-height: 1.4; color: var(--text); }
.wk-hl-card p { margin: 0; font-size: .9rem; line-height: 1.55; }
.wk-action { color: var(--ueh-teal-dark); font-weight: 600; }
.wk-refs summary { cursor: pointer; font-size: .8rem; color: var(--ueh-teal); font-weight: 600; }
.wk-refs ul { margin: .4rem 0 0; padding-left: 1.1rem; font-size: .84rem; display: flex; flex-direction: column; gap: .35rem; }
.wk-refs li span { display: block; }
.txt-bad { color: var(--bad-text); font-weight: 600; }
.wk-risks { margin-top: 1.1rem; padding: .8rem 1rem; border: 1px solid #F3C7C2; background: #FFF6F5; border-radius: 10px; }
.wk-risks h3 { margin: 0 0 .4rem; color: var(--bad-text); }
.wk-risks ul { margin: 0; padding-left: 1.2rem; display: flex; flex-direction: column; gap: .3rem; font-size: .92rem; }
.wk-routine { margin-top: 1rem; }
.wk-skip { display: inline-flex; gap: .3rem; flex-wrap: wrap; margin-left: .3rem; }
.chip { display: inline-block; padding: .05rem .5rem; border-radius: 999px; background: #EEF2F2; color: var(--muted); font-size: .74rem; }

.wk-charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1.25rem; }
.ch-card h2 { margin-bottom: .3rem; }
.ch-card h3 { margin-top: 1.2rem; }
.ch-card > p.small { margin: 0 0 .5rem; }
.ch-wide { grid-column: 1 / -1; }
.ch-legend { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .82rem; color: var(--muted); margin: .2rem 0 .6rem; }
.ch-legend span { display: inline-flex; align-items: center; gap: .4rem; }
.ch-plot { position: relative; height: 210px; margin: 1.1rem 0 0 2.2rem; border-bottom: 1px solid #B9C6C8; }
.ch-gl { position: absolute; left: 0; right: 0; border-top: 1px dashed #E3EAEB; }
.ch-gl span { position: absolute; right: calc(100% + .45rem); top: -.55rem; font-size: .7rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.ch-gl:first-child { border-top: 0; }
.ch-cols { position: absolute; inset: 0; display: flex; }
.ch-col { flex: 1 1 0; display: flex; align-items: flex-end; justify-content: center; border-radius: 6px; outline: none; }
.ch-col:hover, .ch-col:focus-visible { background: rgba(0,95,105,.05); }
.ch-col.is-off { opacity: .35; }
.ch-bars { display: flex; align-items: flex-end; gap: 2px; height: 100%; width: 78%; max-width: 64px; }
.ch-bars i { flex: 1 1 0; background: var(--c); border-radius: 4px 4px 0 0; position: relative; min-width: 0; }
.ch-bars b { font-style: normal; position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); font-size: .7rem; font-weight: 600; color: var(--text); padding-bottom: 2px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ch-x { display: flex; margin-left: 2.2rem; }
.ch-x span { flex: 1 1 0; text-align: center; font-size: .76rem; font-weight: 600; color: var(--text); padding-top: .35rem; line-height: 1.2; }
.ch-x span small { display: block; font-weight: 400; color: var(--muted); font-size: .68rem; }
.ch-x span.is-off { opacity: .45; }
.ch-line { margin-right: 1.6rem; }
.ch-area { position: absolute; inset: 0; }
.ch-area svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.ch-area polyline { fill: none; stroke: var(--c); stroke-width: 2.25; stroke-linejoin: round; stroke-linecap: round; }
.ch-dot { position: absolute; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 2px var(--surface); pointer-events: none; }
.ch-end { position: absolute; left: calc(100% + .45rem); transform: translateY(-50%); font-style: normal; font-size: .74rem; font-weight: 700; color: var(--text); }
.ch-hit { position: absolute; top: 0; bottom: 0; outline: none; }
.ch-hit:hover::after, .ch-hit:focus-visible::after { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; border-left: 1px solid #9FB0B2; }
.ch-x-line { position: relative; height: 2.3rem; margin-right: 1.6rem; }
.ch-x-line span { position: absolute; transform: translateX(-50%); flex: none; }
.ch-table { margin-top: .7rem; font-size: .85rem; }
.ch-table summary { cursor: pointer; color: var(--muted); font-size: .8rem; }
.ch-table table { margin-top: .4rem; }
.ch-table th, .ch-table td { padding: .35rem .5rem; }
.ch-table .num { text-align: right; }
.hb { display: flex; flex-direction: column; gap: .4rem; margin-top: .4rem; }
.hb-row { display: grid; grid-template-columns: minmax(0, 15rem) minmax(0, 1fr) 2.8rem; gap: .6rem; align-items: center; padding: .1rem .25rem; border-radius: 6px; outline: none; }
.hb-row:hover, .hb-row:focus-visible { background: rgba(0,95,105,.05); }
.hb-lab { font-size: .84rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hb-track { display: flex; gap: 2px; height: 14px; }
.hb-track i { background: var(--c); height: 100%; min-width: 3px; }
.hb-track i:first-child { border-radius: 4px 0 0 4px; }
.hb-track i:last-child { border-radius: 0 4px 4px 0; }
.hb-track i:only-child { border-radius: 4px; }
.hb-val { font-size: .84rem; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.stack100 { display: flex; gap: 2px; height: 22px; margin: .8rem 0; }
.stack100 i { background: var(--c); outline: none; }
.stack100 i:first-child { border-radius: 6px 0 0 6px; }
.stack100 i:last-child { border-radius: 0 6px 6px 0; }
.stack100 i:only-child { border-radius: 6px; }
.src-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .45rem; }
.src-list li { display: flex; align-items: center; gap: .5rem; font-size: .9rem; }
.src-list b { margin-left: auto; font-variant-numeric: tabular-nums; }
.src-list span { width: 3rem; text-align: right; color: var(--muted); font-size: .82rem; }
.wk-over td { font-size: .88rem; }
.ch-tip { position: fixed; z-index: 100; max-width: 320px; background: #10282B; color: #fff; font-size: .8rem; line-height: 1.45; padding: .45rem .65rem; border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.22); pointer-events: none; }
@media (max-width: 1100px) { .wk-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 860px) { .wk-charts { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 520px) {
  .wk-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
  .kp { padding: .7rem .75rem; }
  .kp b { font-size: 1.55rem; }
  .wk-hl { grid-template-columns: minmax(0, 1fr); }
  .hb-row { grid-template-columns: minmax(0, 8.5rem) minmax(0, 1fr) 2.4rem; gap: .4rem; }
  .ch-plot { height: 180px; }
  .ch-bars b { font-size: .62rem; }
  .wk-area { margin-left: 0; width: 100%; }
  .wk-yr { display: none; }
}

/* Nghiên cứu (OpenAlex) */
.rs-main { display: flex; gap: 1rem; align-items: flex-start; }
.rs-main h3 { flex: 1 1 auto; min-width: 0; }
.rs-pdf { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; margin-top: .3rem; padding: .3rem .6rem; border: 1px solid #F3C9B0; border-radius: 8px; background: #FFF6F0; text-decoration: none; line-height: 1.15; }
.rs-pdf b { color: #B3261E; font-size: .9rem; letter-spacing: .04em; }
.rs-pdf span { font-size: .64rem; color: var(--muted); }
.rs-pdf:hover { background: #FFE9DC; border-color: var(--ueh-orange); }
.rs-pdf-l { font-weight: 700; color: #B3261E; }
:root { --s-c5: #1baf7a; --s-c6: #eda100; --s-c7: #e87ba4; --s-c8: #008300; }
.s-c5 { --c: var(--s-c5); } .s-c6 { --c: var(--s-c6); } .s-c7 { --c: var(--s-c7); } .s-c8 { --c: var(--s-c8); }
.rs-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; }
.rs-inst { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.rs-inst > span { background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: .3rem .8rem; font-size: .84rem; color: var(--muted); }
.rs-inst b { color: var(--ueh-teal-dark); font-variant-numeric: tabular-nums; }
.rs-trend { border-top: 4px solid var(--ueh-orange); background: linear-gradient(180deg, #FFF8F3 0, var(--surface) 8rem); }
.rs-trend > summary { cursor: pointer; list-style: none; display: flex; flex-direction: column; gap: .15rem; }
.rs-trend > summary::-webkit-details-marker { display: none; }
.rs-trend-ttl { font-size: 1.15rem; font-weight: 700; color: var(--ueh-teal-dark); }
.rs-trend-ttl::after { content: " ▾"; color: var(--muted); font-size: .9rem; }
.rs-trend:not([open]) .rs-trend-ttl::after { content: " ▸"; }
.rs-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .75rem; margin: 1rem 0; }
.rs-tgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.rs-tbox { border: 1px solid var(--border); border-radius: 12px; padding: .9rem 1rem; background: var(--surface); min-width: 0; }
.rs-tbox h3 { margin: 0 0 .5rem; }
.rs-tbox h3.rs-sub { margin-top: 1rem; }
.rs-tbox > p.small { margin: -.3rem 0 .6rem; }
.rs-wide { grid-column: 1 / -1; }
.rs-chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.rs-chip { display: inline-flex; align-items: center; gap: .35rem; padding: .25rem .65rem; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); text-decoration: none; font-size: calc(.84rem * var(--w, 1)); line-height: 1.35; }
a.rs-chip:hover { border-color: var(--ueh-teal); background: var(--ueh-teal-light); }
.rs-chip b { font-size: .74rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.rs-chip em { font-style: normal; font-size: .7rem; font-weight: 700; color: var(--good-text); }
.rs-chip.is-hot { border-color: #F5C2A6; background: #FFF4EC; font-weight: 600; }
.rs-chip.is-on { background: var(--ueh-teal); border-color: var(--ueh-teal); color: #fff; }
.rs-chip.is-on:hover { background: var(--ueh-teal-dark); }
.rs-chip.is-sdg { border-color: #BFE3C9; background: #F1FAF3; }
.rs-hb .hb-row { text-decoration: none; color: inherit; grid-template-columns: minmax(0, 1fr) minmax(0, 40%) 3.4rem; }
.rs-hb .hb-lab { white-space: normal; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.hb-val small { display: inline-block; margin-left: .25rem; font-size: .66rem; font-weight: 700; color: var(--muted); }
.hb-val small.up { color: var(--good-text); }
.hb-val small.down { color: var(--bad-text); }
.rs-rank { margin: 0; padding-left: 1.3rem; display: flex; flex-direction: column; gap: .35rem; font-size: .88rem; }
.rs-rank li { padding-right: 2.2rem; position: relative; }
.rs-rank li b { position: absolute; right: 0; top: 0; font-variant-numeric: tabular-nums; }
.rs-rank a { color: var(--text); text-decoration: none; }
.rs-rank a:hover { color: var(--ueh-teal); text-decoration: underline; }
.src-list a { color: var(--text); text-decoration: none; }
.src-list a:hover { color: var(--ueh-teal); text-decoration: underline; }

.rs-search { padding: 1rem 1.1rem; }
.rs-qrow { display: flex; gap: .5rem; align-items: center; position: relative; }
.rs-qico { position: absolute; left: .8rem; top: 13px; color: var(--muted); display: grid; pointer-events: none; }
.rs-qrow input[type=search] { flex: 1 1 auto; min-width: 0; padding: .7rem .9rem .7rem 2.6rem; font-size: 1.02rem; border-radius: 999px; }
.rs-qrow .btn { border-radius: 999px; padding-left: 1.2rem; padding-right: 1.2rem; }
.rs-filters { display: flex; gap: .6rem 1rem; flex-wrap: wrap; align-items: flex-end; margin-top: .8rem; }
.rs-filters label { font-size: .78rem; flex: 0 1 auto; }
.rs-filters select, .rs-filters input { min-width: 0; font-weight: 400; }
.rs-filters label:not(.check) select { max-width: 17rem; }
.rs-oachk { align-self: center; padding-top: 1rem; font-size: .88rem !important; }
.rs-adv { margin-top: .6rem; }
.rs-adv summary { cursor: pointer; font-size: .84rem; color: var(--ueh-teal); font-weight: 600; }
.rs-adv label { flex: 1 1 14rem; }
.rs-active { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin-top: .8rem; padding-top: .7rem; border-top: 1px dashed var(--border); }
.rs-clear { font-size: .82rem; color: var(--bad-text); margin-left: .3rem; }
.rs-bar { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin: 0 .25rem .6rem; color: var(--muted); font-size: .9rem; }
.rs-bar strong { color: var(--text); }
.rs-years { display: flex; gap: 3px; align-items: flex-end; height: 44px; }
.rs-years a { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; width: 22px; height: 100%; text-decoration: none; }
.rs-years i { width: 100%; background: var(--s-c1); border-radius: 3px 3px 0 0; opacity: .75; }
.rs-years a:hover i { opacity: 1; }
.rs-years small { font-size: .6rem; color: var(--muted); line-height: 1.3; }
.rs-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.rs-item { padding: 1rem 1.25rem 1.05rem; border-top: 1px solid var(--border); }
.rs-item:first-child { border-top: 0; }
.rs-item:hover { background: #FBFDFD; }
.rs-item.is-retracted { opacity: .6; }
.rs-m1 { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; font-size: .76rem; }
.rs-type { font-weight: 700; color: var(--ueh-teal); text-transform: uppercase; letter-spacing: .04em; font-size: .7rem; }
.rs-oa { color: #8A5A00; background: #FFF4D6; padding: .05rem .45rem; border-radius: 4px; font-weight: 600; }
.rs-m1 time { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 600; }
.rs-item h3 { margin: .3rem 0 .25rem; font-size: 1.08rem; line-height: 1.4; font-weight: 600; }
.rs-item h3 a { color: #1A0DAB; text-decoration: none; }
.rs-item h3 a:visited { color: #681DA8; }
.rs-item h3 a:hover { text-decoration: underline; }
.rs-auth { font-size: .86rem; color: #2E6B3A; line-height: 1.5; }
.rs-auth a.is-ueh { color: #1E5C2B; font-weight: 700; text-decoration: none; border-bottom: 1px dotted #7DB38A; }
.rs-auth a.is-ueh:hover { border-bottom-style: solid; }
.rs-venue { font-size: .84rem; color: var(--muted); font-style: italic; margin-top: .1rem; }
.rs-venue a { color: var(--muted); text-decoration: none; }
.rs-venue a:hover { color: var(--ueh-teal); text-decoration: underline; }
.rs-abs { margin: .45rem 0 0; font-size: .88rem; line-height: 1.6; color: #3B4A4C; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; cursor: pointer; }
.rs-abs.open { -webkit-line-clamp: unset; display: block; }
.rs-foot { display: flex; gap: .35rem 1rem; flex-wrap: wrap; align-items: center; margin-top: .55rem; font-size: .8rem; }
.rs-foot a { text-decoration: none; }
.rs-foot a:hover { text-decoration: underline; }
.rs-cited { font-weight: 700; color: var(--ueh-teal); }
.rs-fwci-hi { color: var(--good-text); font-weight: 700; }
.rs-topic { color: var(--muted); }
.rs-pager { display: flex; gap: .3rem; justify-content: center; flex-wrap: wrap; margin: 1.2rem 0 .5rem; }
.rs-pager a, .rs-pager span { min-width: 2.3rem; padding: .4rem .65rem; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); text-align: center; text-decoration: none; color: var(--text); font-size: .9rem; }
.rs-pager a:hover { border-color: var(--ueh-teal); color: var(--ueh-teal); }
.rs-pager .on { background: var(--ueh-teal); border-color: var(--ueh-teal); color: #fff; font-weight: 700; }
.rs-pager .gap { border: 0; background: none; min-width: 1rem; }
.rs-empty p { margin: 0; }
.rs-src { margin-top: 1rem; text-align: center; }
@media (max-width: 860px) { .rs-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .rs-tgrid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 520px) {
  .rs-item { padding: .85rem .9rem; }
  .rs-m1 time { margin-left: 0; }
  .rs-qrow { flex-wrap: wrap; }
  .rs-qrow .btn { width: 100%; }
  .rs-filters label { flex: 1 1 45%; }
  .rs-filters label:not(.check) select { max-width: none; width: 100%; }
  .rs-years { display: none; }
}

/* Nghiên cứu — trích dẫn theo thời gian */
.rs-cite { border-top: 4px solid var(--s-c2); }
.rs-cite > summary { cursor: pointer; list-style: none; display: flex; flex-direction: column; gap: .15rem; }
.rs-cite > summary::-webkit-details-marker { display: none; }
.rs-cite:not([open]) .rs-trend-ttl::after { content: " ▸"; }
.ct-kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.ct-note { margin: .5rem 0 0; }
.ct-top { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .7rem; }
.ct-top li { display: grid; grid-template-columns: 1.6rem minmax(0, 1fr) auto; gap: .6rem; align-items: start; }
.ct-rank { width: 1.6rem; height: 1.6rem; border-radius: 50%; display: grid; place-items: center; background: var(--ueh-teal-light); color: var(--ueh-teal-dark); font-weight: 800; font-size: .78rem; }
.ct-title { color: #1A0DAB; text-decoration: none; font-weight: 600; font-size: .9rem; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ct-title:hover { text-decoration: underline; }
.ct-meta { font-size: .76rem; margin-top: .15rem; color: #2E6B3A; }
.ct-meta.muted { color: var(--muted); font-style: italic; }
.ct-n { display: flex; flex-direction: column; align-items: flex-end; text-decoration: none; font-weight: 800; color: var(--ueh-orange-dark); font-size: 1.05rem; font-variant-numeric: tabular-nums; line-height: 1.1; }
.ct-n small { font-size: .62rem; font-weight: 600; color: var(--muted); }
@media (max-width: 1100px) { .ct-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 720px) { .ct-many .ch-bars b { display: none; } .ct-many .ch-x span small { display: none; } .ct-many .ch-x span { font-size: .6rem; } }
@media (max-width: 520px) { .ct-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.rs-auth a.is-ueh sup { font-size: .6rem; font-weight: 700; color: var(--ueh-orange-dark); margin-left: 1px; }
.rs-lead { color: var(--ueh-teal-dark); background: var(--ueh-teal-light); padding: .05rem .45rem; border-radius: 4px; font-weight: 700; }
.ct-src { display: flex; flex-direction: column; gap: .8rem; margin: .4rem 0 .8rem; }
.ct-src-row { outline: none; }
.ct-src-top { display: flex; justify-content: space-between; font-size: .88rem; font-weight: 600; margin-bottom: .25rem; }
.ct-src-top b { font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.ct-src-row .hb-track { height: 10px; background: #EEF2F2; border-radius: 5px; }
.ct-src-row .hb-track i { border-radius: 5px; }
.ct-src-row small { display: block; margin-top: .2rem; font-size: .74rem; }
.ct-meta sup.kn { font-size: .58rem; font-weight: 700; color: var(--ueh-orange-dark); margin-left: 1px; }

/* Nghiên cứu — lưới khối: 6 cột (nửa = 3, một phần ba = 2), khối cùng hàng cao bằng nhau, biểu đồ giãn lấp chỗ trống */
.rs-tgrid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.rs-tgrid > .rs-tbox { grid-column: span 3; }
.rs-tgrid > .rs-tbox.rs-third { grid-column: span 2; }
.rs-tgrid > .rs-tbox.rs-wide { grid-column: 1 / -1; }
.rs-tgrid > .ch-card { display: flex; flex-direction: column; }
.rs-tgrid > .ch-card > .ch-plot { flex: 1 0 210px; height: auto; min-height: 210px; }
.rs-tgrid > .ch-card > .ch-table { margin-top: auto; padding-top: .7rem; }
.rs-wide .ct-src { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem 1.75rem; }
.rs-wide .ct-src-row { padding: .7rem .8rem; border-radius: 10px; background: #F7FAFA; }
.rs-tgrid > .rs-tbox > .ct-top { flex: 1 1 auto; }
/* Khối danh sách ngắn hơn khối bên cạnh: giãn đều các dòng thay vì để trống phía dưới */
.rs-tgrid > .rs-fill { display: flex; flex-direction: column; }
.rs-fill > .src-list { flex: 1 1 auto; justify-content: space-evenly; gap: .3rem; }
@media (max-width: 1100px) {
  .rs-tgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rs-tgrid > .rs-tbox, .rs-tgrid > .rs-tbox.rs-third { grid-column: span 1; }
  .rs-tgrid > .rs-tbox.rs-tabwide { grid-column: 1 / -1; }
}
@media (max-width: 860px) {
  .rs-tgrid { grid-template-columns: minmax(0, 1fr); }
  .rs-tgrid > .rs-tbox, .rs-tgrid > .rs-tbox.rs-third { grid-column: 1 / -1; }
  .rs-tgrid > .ch-card > .ch-plot { flex-basis: 190px; min-height: 190px; }
}
@media (max-width: 720px) { .rs-wide .ct-src { grid-template-columns: minmax(0, 1fr); gap: .6rem; } }
@media (max-width: 520px) {
  .rs-tbox { padding: .75rem .8rem; }
  .rs-tgrid { gap: .75rem; }
  .rs-trend, .rs-cite { padding-left: .8rem; padding-right: .8rem; }
}
@media (max-width: 1100px) and (min-width: 861px) { .rs-tgrid > .ct-many:not(.rs-wide) .ch-x span { font-size: .6rem; } .rs-tgrid > .ct-many:not(.rs-wide) .ch-x span small { display: none; } .rs-tgrid > .ct-many:not(.rs-wide) .ch-bars b { font-size: .58rem; } }
@media (max-width: 520px) {
  /* Nhãn năm: hiện cách một (luôn giữ năm mới nhất) để không dính nhau */
  .rs-tgrid .ct-many .ch-x span:nth-last-child(even) { visibility: hidden; }
  .rs-tgrid .ct-many .ch-x span { font-size: .66rem; min-width: 0; overflow: visible; white-space: nowrap; }
  /* Danh sách top: 5 bài đầu trên điện thoại */
  .ct-top li:nth-child(n+6) { display: none; }
}
