/* ---- Link rút gọn của tôi (portal-links.js: pageLinks) – tiền tố el- */
.el-hero { padding: 18px; background: linear-gradient(135deg, #f4f8ff 0%, #ffffff 60%); border: 1px solid #dbe6f7; margin-bottom: 14px; }
.el-modes { display: inline-flex; gap: 4px; padding: 3px; background: #e9eef7; border-radius: 10px; margin-bottom: 12px; max-width: 100%; overflow-x: auto; }
.el-modes button { border: 0; background: none; border-radius: 8px; padding: 7px 14px; font: inherit; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap; }
.el-modes button.on { background: var(--surface); color: var(--brand); box-shadow: 0 1px 3px rgb(15 23 42 / 12%); }
.el-form { display: grid; gap: 10px; }
.el-big { display: flex; gap: 8px; }
.el-big input { flex: 1; min-width: 0; font-size: 16px; padding: 12px 14px; border-radius: 10px; border: 1.5px solid #c9d6ea; background: #fff; }
.el-big input:focus { border-color: var(--brand-2); outline: 3px solid rgb(11 74 158 / 15%); outline-offset: 0; }
.el-big .btn { padding: 0 22px; font-size: 15px; font-weight: 700; border-radius: 10px; flex: none; }
.btn.loading { position: relative; color: transparent !important; }
.btn.loading::after { content: ''; position: absolute; inset: 0; margin: auto; width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgb(255 255 255 / 45%); border-top-color: #fff; animation: el-spin .7s linear infinite; }
@keyframes el-spin { to { transform: rotate(360deg); } }
.el-hint { min-height: 18px; }
.el-hint .warn, .el-hint.warn { color: var(--warn); }
.el-hint .ok, .el-hint.ok { color: var(--ok); }
.el-dup { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px; color: #1e3a8a; background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 8px; padding: 4px 8px; }
.el-opt summary { cursor: pointer; font-size: 13px; color: var(--brand-2); font-weight: 600; list-style: none; width: max-content; max-width: 100%; }
.el-opt summary::-webkit-details-marker { display: none; }
.el-opt[open] summary { margin-bottom: 10px; }
.el-opt-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; }
.el-opt-grid .el-full { grid-column: 1 / -1; }
.el-alias { display: flex; align-items: stretch; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface-2); }
.el-alias em { font-style: normal; font-size: 13px; color: var(--muted); padding: 0 4px 0 10px; display: flex; align-items: center; white-space: nowrap; max-width: 55%; overflow: hidden; text-overflow: ellipsis; }
.el-alias input { border: 0 !important; border-radius: 0 !important; min-width: 0; flex: 1; }
.el-alias input:focus { outline: none; }
.el-alias:focus-within { outline: 2px solid var(--brand-2); outline-offset: 1px; }
.el-form small.ok { color: var(--ok); } .el-form small.danger { color: var(--danger); }
.el-form textarea { font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; }

/* Kết quả vừa tạo */
.el-made { margin-top: 14px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: center; background: #fff; border: 1.5px solid #a7f3d0; border-radius: 12px; padding: 14px 16px; box-shadow: 0 6px 20px rgb(5 150 105 / 10%); animation: el-pop .25s ease-out; }
.el-made.many { grid-template-columns: minmax(0, 1fr); gap: 10px; }
@keyframes el-pop { from { transform: translateY(-4px); opacity: 0; } to { transform: none; opacity: 1; } }
.el-made-main { display: grid; gap: 8px; min-width: 0; }
.el-made-k { font-weight: 700; color: var(--ok); }
.el-short a { font: 700 22px ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--brand); text-decoration: none; word-break: break-all; }
.el-short.sm a { font-size: 17px; }
.el-made .ellipsis { max-width: 100%; }
.el-made-acts { flex-wrap: wrap; gap: 8px; }
.el-made-qr { display: grid; justify-items: center; gap: 6px; }
.el-qr { display: block; border-radius: 8px; border: 1px solid var(--line); background: #fff; max-width: 100%; height: auto; }
.el-res { max-height: 300px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.el-res-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 6px 10px; border-top: 1px solid var(--line); font-size: 13px; }
.el-res-row:first-child { border-top: 0; }
.el-res-row.bad { background: #fef2f2; }
.el-res-row .ellipsis { max-width: none; }
.el-res-row .lk-code { font-size: 13px; }

/* Nút chia sẻ */
.el-share { display: flex; gap: 6px; flex-wrap: wrap; }
.el-sh { min-width: 34px; height: 32px; border-radius: 8px; border: 0; color: #fff; font: 700 14px/1 system-ui, sans-serif; cursor: pointer; padding: 0 10px; transition: transform .1s, filter .1s; }
.el-sh:hover { filter: brightness(1.08); transform: translateY(-1px); }
.el-sh.fb { background: #1877f2; font-family: Georgia, serif; font-size: 18px; }
.el-sh.zl { background: #0068ff; font-size: 12px; }
.el-sh.tg { background: #229ed9; }
.el-sh.x { background: #111; }
.el-sh.more { background: #64748b; }

/* KPI + danh sách */
.el-kpis a.cm-kpi { text-decoration: none; }
.el-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 14px; align-items: start; }
.el-main { min-width: 0; }
.el-side { display: grid; gap: 14px; position: sticky; top: 16px; }
.el-side .card { margin: 0; }
.el-side h3 { margin-top: 0; }
.el-filters { margin: 10px 0 12px; flex-wrap: wrap; }
.el-filters input[type=search] { flex: 1; min-width: 180px; }
.el-filters select { width: auto; }
.el-row { display: grid; grid-template-columns: 34px minmax(0, 1fr) 128px 132px 116px 48px; gap: 8px; align-items: center; padding: 10px 12px; border-top: 1px solid var(--line); cursor: pointer; }
.el-row:hover { background: #f8fafd; }
.el-row.on { background: #eef4ff; }
.el-row.off { opacity: .62; }
.el-row.off:hover { opacity: 1; }
.el-row.cm-head { cursor: default; }
.el-row .lk-main { min-width: 0; display: grid; gap: 3px; }
.el-row .ellipsis { max-width: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.el-row .cm-flags { display: flex; flex-wrap: wrap; gap: 4px; }
.el-row .cm-flags .pill { font-size: 11px; padding: 1px 7px; }
.el-code-row { gap: 6px; flex-wrap: nowrap; min-width: 0; }
.el-code-row .lk-code { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.el-code-row .lk-cp { flex: none; }
.el-title { font-weight: 600; font-size: 13px; }
.el-rates { display: grid; gap: 2px; }
.el-rate { display: grid; grid-template-columns: minmax(0, 1fr) 60px auto; gap: 8px; align-items: center; font-size: 13px; padding: 4px 0; }
.el-rate b { text-align: right; color: var(--ok); }
.el-rate .pr-m { margin: 0; }
.el-top { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; counter-reset: el; }
.el-top li { display: flex; align-items: center; gap: 6px; counter-increment: el; }
.el-top li::before { content: counter(el); flex: none; width: 20px; height: 20px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--line); font-size: 11px; font-weight: 700; display: grid; place-items: center; color: var(--muted); }
.el-top li:first-child::before { background: #fef3c7; border-color: #fcd34d; color: #92400e; }
.el-top button { flex: 1; min-width: 0; text-align: left; border: 0; background: none; padding: 4px 6px; border-radius: 6px; cursor: pointer; display: grid; font: inherit; color: inherit; }
.el-top button:hover { background: var(--surface-2); }
.el-top button .lk-code { font-size: 13px; }
.el-top small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.el-tips ul { margin: 0 0 10px; padding-left: 18px; display: grid; gap: 6px; font-size: 13px; }

/* API */
.el-api { margin-top: 14px; }
.el-api-head { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; margin-bottom: 12px; }
.el-key { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.el-key-hint { font: 13px ui-monospace, Menlo, monospace; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 3px 8px; }
.el-key-new { display: grid; gap: 2px; background: #ecfdf5; border: 1px solid #a7f3d0; border-radius: 8px; padding: 6px 10px; min-width: 0; }
.el-key-new small { color: #047857; font-weight: 600; }
.el-key-new code { font: 13px ui-monospace, Menlo, monospace; word-break: break-all; }
.el-ep { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 8px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.el-ep:first-child { border-top: 0; padding-top: 0; }
.el-ep code { font: 12.5px ui-monospace, Menlo, monospace; word-break: break-all; }
.el-ep small { grid-column: 2; }
.el-langs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 6px; }
.el-langs button { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 3px 12px; font: inherit; font-size: 12px; cursor: pointer; color: var(--muted); }
.el-langs button.on { background: #0f172a; border-color: #0f172a; color: #fff; }
.el-code { position: relative; }
.el-code pre { background: #0f172a; color: #e2e8f0; border-radius: 10px; padding: 12px 14px; padding-right: 112px; margin: 0; font: 12px/1.6 ui-monospace, Menlo, monospace; white-space: pre-wrap; word-break: break-all; min-height: 64px; }
.el-code .btn { position: absolute; top: 8px; right: 8px; background: rgb(255 255 255 / 10%); border-color: rgb(255 255 255 / 20%); color: #fff; }

/* Cửa sổ thống kê 1 link */
.el-stat h4 { margin: 14px 0 6px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.el-stat-top { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; align-items: start; }
.el-mini { margin: 14px 0 0; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.el-mini .cm-kpi { cursor: default; background: var(--surface-2); box-shadow: none; border: 1px solid var(--line); }
.el-mini .cm-kpi b { font-size: 20px; }
.el-stat .bars { overflow: visible; gap: 2px; }
.el-stat .bars .bar { flex: 1 1 0; min-width: 3px; }
.el-stat .pb-dev { grid-template-columns: minmax(0, 1fr) 80px 44px; }

@media (max-width: 1280px) {
  .el-grid { grid-template-columns: minmax(0, 1fr); }
  .el-side { position: static; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); align-items: start; }
}
@media (max-width: 1100px) {
  .el-row { grid-template-columns: 34px minmax(0, 1fr) 124px 132px 48px; }
  .el-row > :nth-child(5) { display: none; }
}
@media (max-width: 700px) {
  .el-hero { padding: 14px; }
  .el-big { flex-direction: column; }
  .el-big .btn { padding: 11px; justify-content: center; }
  .el-opt-grid { grid-template-columns: minmax(0, 1fr); }
  .el-made { grid-template-columns: minmax(0, 1fr); }
  .el-made-qr { justify-items: start; }
  .el-short a { font-size: 18px; }
  .el-row { grid-template-columns: 30px minmax(0, 1fr) auto; grid-template-areas: "ck main tog" ". spark conv" ". earn earn"; row-gap: 6px; align-items: end; }
  .el-row > :nth-child(5) { display: flex; grid-area: earn; gap: 8px; align-items: baseline; font-size: 13px; }
  .el-row > :nth-child(5)::before { content: 'Thu nhập 30 ngày:'; color: var(--muted); font-size: 12px; }
  .el-row.cm-head { display: none; }
  .el-row > .cm-ck { grid-area: ck; align-self: start; }
  .el-row > .lk-main { grid-area: main; }
  .el-row > .lk-tog { grid-area: tog; align-self: start; }
  .el-row > :nth-child(3) { grid-area: spark; }
  .el-row > :nth-child(4) { grid-area: conv; text-align: right; }
  .el-row > :nth-child(4) .pb-ip { display: inline-block; min-width: 90px; }
  .el-row .pb-spark { width: 100px; }
  .el-stat-top { grid-template-columns: minmax(0, 1fr); }
  .el-stat-top .el-made-qr { display: none; }
  .el-mini { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .el-mini .cm-kpi { padding: 8px; }
  .el-mini .cm-kpi span { font-size: 10px; }
  .el-mini .cm-kpi b { font-size: 16px; }
  .el-code pre { padding-right: 14px; padding-top: 40px; }
  .el-res-row { grid-template-columns: minmax(0, 1fr) auto; }
  .el-res-row > :first-child { grid-column: 1 / -1; }
}

/* ---- Giới thiệu (portal-links.js: pageReferrals) – tiền tố rf- */
.rf-hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px; align-items: center; border-radius: 14px; padding: 20px 22px; color: #fff;
  background: radial-gradient(120% 140% at 100% 0%, #1d5bb8 0%, rgb(29 91 184 / 0%) 55%), linear-gradient(135deg, #022352 0%, #0b3a7a 100%); box-shadow: 0 10px 30px rgb(2 35 82 / 25%); }
.rf-hero-main { display: grid; gap: 12px; min-width: 0; }
.rf-k { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: #b8cbe2; font-weight: 600; }
.rf-link { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.rf-link span { font: 600 17px ui-monospace, SFMono-Regular, Menlo, monospace; background: rgb(255 255 255 / 10%); border: 1px solid rgb(255 255 255 / 18%); border-radius: 10px; padding: 9px 12px; word-break: break-all; flex: 1; min-width: 0; }
.rf-link .btn.primary { background: #fff; color: var(--brand); border-color: #fff; font-weight: 700; }
.rf-code { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.rf-code .muted { color: #b8cbe2; }
.rf-code b { font: 800 20px ui-monospace, Menlo, monospace; letter-spacing: .12em; background: #fff; color: var(--brand); border-radius: 8px; padding: 2px 10px; }
.rf-code .lk-cp { background: rgb(255 255 255 / 12%); border-color: rgb(255 255 255 / 25%); color: #fff; }
.rf-msg summary { cursor: pointer; font-size: 13px; color: #dbe7f7; width: max-content; max-width: 100%; }
.rf-msg[open] summary { margin-bottom: 8px; }
.rf-msg textarea { width: 100%; background: rgb(255 255 255 / 95%); color: var(--text); font-size: 13px; margin-bottom: 6px; }
.rf-msg .btn { background: rgb(255 255 255 / 12%); border-color: rgb(255 255 255 / 25%); color: #fff; }
.rf-hero-qr { display: grid; justify-items: center; gap: 8px; }
.rf-hero-qr .el-qr { border: 0; border-radius: 10px; }
.rf-hero-qr .btn { background: rgb(255 255 255 / 12%); border-color: rgb(255 255 255 / 25%); color: #fff; }
.rf-rules { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 14px; }
.rf-rule { display: grid; gap: 10px; align-content: start; margin: 0; }
.rf-rule.off { opacity: .6; }
.rf-rule-h { display: flex; gap: 10px; align-items: center; }
.rf-ico { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 20px; background: #eff6ff; }
.rf-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; counter-reset: rf; }
.rf-steps li { counter-increment: rf; display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 8px; align-items: center; font-size: 13.5px; }
.rf-steps li::before { content: counter(rf); width: 24px; height: 24px; border-radius: 50%; background: var(--brand); color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.rf-calc { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; justify-content: space-between; background: #f0fdf4; border: 1px dashed #86efac; border-radius: 10px; padding: 8px 12px; font-size: 13px; }
.rf-calc label { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.rf-calc input { width: 120px; padding: 4px 8px; text-align: right; font-weight: 600; }
.rf-calc b { color: var(--ok); font-size: 16px; }
.rf-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 14px; }
.rf-grid > .card { margin: 0; min-width: 0; }
.rf-grid .bars { overflow: visible; gap: 2px; }
.rf-grid .bars .bar { flex: 1 1 0; min-width: 3px; }
.rf-empty-chart { height: 120px; display: grid; place-items: center; text-align: center; background: repeating-linear-gradient(0deg, var(--surface-2) 0 1px, transparent 1px 30px); border-radius: 8px; margin-top: 8px; padding: 0 12px; }
.rf-tabs { margin-bottom: 4px; }
.rf-list { display: grid; }
.rf-row { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, .8fr) minmax(0, .9fr); gap: 10px; align-items: center; padding: 10px 4px; border-top: 1px solid var(--line); }
.rf-row:first-child { border-top: 0; }
.rf-head { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; padding: 8px 4px; }
.rf-row.cm { grid-template-columns: minmax(0, 2fr) 110px minmax(0, 1fr) 120px; }
.rf-who { display: flex; gap: 10px; align-items: center; min-width: 0; }
.rf-who > div { min-width: 0; }
.rf-who b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rf-av { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: #e0ecff; color: var(--brand-2); }
.rf-av.pub { background: #ecfdf5; }
.rf-amt { text-align: right; }
.rf-list .cm-empty, #rf-body > .cm-empty { padding: 28px 12px; }

@media (max-width: 1000px) {
  .rf-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 800px) {
  .rf-rules { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 700px) {
  .rf-hero { grid-template-columns: minmax(0, 1fr); padding: 16px; }
  .rf-hero-qr { grid-template-columns: auto auto; justify-content: start; align-items: end; }
  .rf-link span { font-size: 14px; flex-basis: 100%; }
  .rf-link .btn { flex: 1; justify-content: center; }
  .rf-row, .rf-row.cm { grid-template-columns: minmax(0, 1fr) auto; gap: 6px 10px; }
  .rf-head { display: none; }
  .rf-row > .rf-who { grid-column: 1 / -1; }
  .rf-head + .rf-row { border-top: 0; }
  .rf-row > [data-label]::before { content: attr(data-label); display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
  .rf-amt { text-align: left; }
}
