/* App đối tác — Apple style */
body.app { background: var(--gray); padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
.app-top { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 52px; padding: 0 20px;
  background: rgba(245, 245, 247, .8); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); border-bottom: 1px solid var(--hair); }
.app-top__t { font-weight: 600; font-size: 15px; }
.app-view { max-width: 560px; margin: 0 auto; padding: 18px 16px 24px; }
.app-hello { font-size: 28px; font-weight: 700; letter-spacing: -.025em; margin: 6px 4px 14px; }
.app-lead { color: var(--muted); font-size: 15px; margin: 4px 4px 12px; }
.app-hero { text-align: center; padding: 28px 8px 6px; }
.app-hero h1 { font-size: 30px; letter-spacing: -.03em; margin: 12px 0 6px; }
.app-hero p { color: var(--muted); margin: 0 auto; max-width: 380px; }
.app-hero__ico { width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto; background: #fff; color: var(--brand); box-shadow: 0 1px 2px rgba(0, 0, 0, .05); }

/* thẻ số dư */
.balance { position: relative; overflow: hidden; border-radius: 26px; padding: 22px 20px 18px; color: #fff;
  background: radial-gradient(120% 140% at 0% 0%, #b8344a 0%, #8E1F2C 45%, #4a0d16 100%); box-shadow: 0 18px 40px rgba(94, 18, 28, .28); }
.balance::after { content: ""; position: absolute; inset: 0; background: linear-gradient(120deg, rgba(255, 255, 255, .18), transparent 40%); pointer-events: none; }
.balance__l { font-size: 13px; opacity: .8; }
.balance__v { display: block; font-size: 40px; letter-spacing: -.035em; line-height: 1.1; margin: 4px 0 2px; }
.balance__hint { display: block; font-size: 13px; opacity: .8; }
.balance__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 18px; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, .2); }
.balance__grid span { display: block; font-size: 11.5px; opacity: .75; }
.balance__grid b { font-size: 15px; }
.balance--sm .balance__v { font-size: 34px; }
.balance .pill--light { position: relative; z-index: 1; margin: 12px 0 8px; background: #fff; color: var(--brand); width: 100%; }
.balance .pill--light[disabled] { background: rgba(255, 255, 255, .35); color: #fff; }

/* hàng điều hướng */
.row-link { display: flex; align-items: center; gap: 12px; width: 100%; padding: 13px 0; border: 0; border-top: 1px solid var(--hair); background: none;
  color: var(--ink) !important; text-decoration: none !important; font: 16px var(--sans); text-align: left; cursor: pointer; }
.card > .row-link:first-child, .card > .card__t + .row-link { border-top: 0; }
.row-link > span:nth-child(2) { flex: 1; }
.row-link em { font-style: normal; color: var(--muted); font-size: 14px; }
.row-link .ico:last-child { color: var(--muted-2); }
.row-link__ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--gray); color: var(--brand); flex-shrink: 0; }
.row-link__ico.ok { background: var(--ok); color: #fff; }
a.card.row-link { padding: 14px 20px; }

/* chia sẻ */
.share__row { display: flex; gap: 14px; align-items: center; }
.share__row .qr { width: 104px; height: 104px; border-radius: 10px; flex-shrink: 0; image-rendering: pixelated; }
.share__code { display: block; font: 700 22px ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: .02em; }
.share__link { font: 600 13px ui-monospace, "SF Mono", Menlo, monospace; background: var(--gray); border-radius: 12px; padding: 10px 12px; margin: 14px 0 12px; word-break: break-all; }
.share__btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.share__btns .pill { min-height: 44px; font-size: 15px; gap: 6px; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; }
.stats b { display: block; font-size: 20px; letter-spacing: -.02em; }
.stats span { font-size: 12px; color: var(--muted); }

/* danh sách */
.list .li { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--hair); }
.list .card__t + .li, .list > .li:first-child { border-top: 0; }
.li > div:first-child { min-width: 0; }
.li b { display: block; font-size: 15.5px; }
.li span { font-size: 12.5px; color: var(--muted); }
.li__r { text-align: right; display: grid; justify-items: end; gap: 3px; flex-shrink: 0; }
.li .pos { color: var(--ok); }
.li .neg { color: var(--err); }
.strike { text-decoration: line-through; color: var(--muted) !important; }
.empty { text-align: center; padding: 40px 16px; }
.empty h2 { font-size: 24px; margin: 14px 0 6px; }
.empty p { color: var(--muted); max-width: 320px; margin: 0 auto 16px; }
.profile { display: flex; gap: 14px; align-items: center; }
.profile .app-hero__ico { margin: 0; width: 52px; height: 52px; background: var(--gray); }
.profile b { display: block; font-size: 18px; }
.profile span { font-size: 13.5px; color: var(--muted); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field select { width: 100%; font: 17px var(--sans); padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); }
.opt { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; margin-bottom: 8px; cursor: pointer; }
.opt input { margin-top: 4px; accent-color: var(--brand); width: 18px; height: 18px; flex-shrink: 0; }
.opt b { display: block; font-size: 15px; }
.opt small { display: block; font-size: 13px; color: var(--muted); line-height: 1.45; margin-top: 2px; }
.opt:has(input:checked) { border-color: var(--brand); background: rgba(142, 31, 44, .04); }
.ok { color: var(--ok); }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.legal-mini p { font-size: 14.5px; color: var(--muted); margin: 0; }
.legal-mini .legal__row:first-of-type { border-top: 0; }

/* hợp đồng */
.doc { max-height: 62vh; overflow: auto; -webkit-overflow-scrolling: touch; }
.contract { font: 14.5px/1.6 "Times New Roman", Georgia, serif; color: #111; }
.contract h1 { font: 700 18px/1.35 "Times New Roman", serif; margin: 14px 0 6px; letter-spacing: 0; }
.contract h2 { font: 700 15px/1.4 "Times New Roman", serif; margin: 16px 0 6px; letter-spacing: 0; }
.contract p { margin: 0 0 8px; text-align: justify; }
.c-center { text-align: center !important; }
.c-muted { color: #666; font-size: 13px; }
.c-tbl { width: 100%; border-collapse: collapse; margin: 4px 0 10px; font-size: 14px; }
.c-tbl td { border: 1px solid #ccc; padding: 6px 8px; vertical-align: top; }
.c-tbl td:first-child { width: 38%; color: #333; }
.c-sign { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; text-align: center; margin: 22px 0 10px; }
.c-sig { max-width: 180px; max-height: 80px; margin: 6px auto; }
.sigpad { position: relative; border: 1.5px dashed var(--line); border-radius: 16px; background: #fff; }
.sigpad canvas { display: block; width: 100%; height: 160px; touch-action: none; cursor: crosshair; }
.sigpad__clear { position: absolute; top: 8px; right: 8px; border: 0; background: var(--gray); border-radius: 980px; padding: 6px 12px; font: 600 13px var(--sans); cursor: pointer; }

/* tab bar */
.tabbar { position: fixed; z-index: 50; left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom)); max-width: 520px; margin: 0 auto;
  display: grid; grid-template-columns: repeat(4, 1fr); border-radius: 26px; padding: 6px; }
.tabbar a { display: grid; justify-items: center; gap: 2px; padding: 6px 0; border-radius: 20px; font-size: 11px; font-weight: 500; color: var(--muted) !important; text-decoration: none !important; }
.tabbar a.on { color: var(--brand) !important; background: rgba(142, 31, 44, .08); }

.toast { position: fixed; z-index: 99; left: 50%; bottom: calc(100px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 980px; font-size: 14px; max-width: 90vw; text-align: center; }
.toast--err { background: var(--err); }

@media print {
  body.app { background: #fff; padding: 0; }
  .app-top, .tabbar, .app-view > *:not(.doc) { display: none !important; }
  .doc { max-height: none; overflow: visible; box-shadow: none; padding: 0; }
}
.doc--full { max-height: none; }
.contract .c-table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 8px 0 12px; }
.contract .c-table th, .contract .c-table td { border: 1px solid #ccc; padding: 5px 6px; text-align: left; vertical-align: top; }
.contract .c-table td:nth-child(n+3) { text-align: right; white-space: nowrap; }
.copy-row { display: flex; gap: 8px; }
.copy-row input { flex: 1; min-width: 0; font: 14px var(--sans); padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--gray); }
