/* App install + notifications (assets/js/pwa.js). Small, quiet, works light and on phones. */
.aff-standalone [data-pwa-install], .aff-no-install [data-pwa-install] { display: none !important; }

.aff-pwa-ic { display: inline-block; width: 20px; height: 20px; vertical-align: middle; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; color: #673ab7; }
.aff-pwa-ic.aff-pwa-fill { fill: currentColor; stroke: none; }

.aff-pwa-btn { appearance: none; border: 1px solid #e4d8f7; background: #fff; color: #4c2a85; font: 600 14px/1 inherit; font-family: inherit; padding: 10px 16px; border-radius: 10px; cursor: pointer; white-space: nowrap; }
.aff-pwa-btn:hover { background: #f6f1fd; }
.aff-pwa-btn.aff-pwa-primary { background: #673ab7; border-color: #673ab7; color: #fff; }
.aff-pwa-btn.aff-pwa-primary:hover { background: #5b2ea8; }
.aff-pwa-btn:focus-visible, .aff-pwa-x:focus-visible { outline: 3px solid #c4b5fd; outline-offset: 2px; }
.aff-pwa-x { appearance: none; border: 0; background: transparent; color: #8b8496; font-size: 22px; line-height: 1; width: 32px; height: 32px; border-radius: 8px; cursor: pointer; flex: none; }
.aff-pwa-x:hover { background: #f3f0f7; color: #3b3446; }

/* Bottom sheet with the install steps */
.aff-pwa-sheet { position: fixed; inset: 0; z-index: 10050; display: flex; align-items: flex-end; justify-content: center; }
.aff-pwa-backdrop { position: absolute; inset: 0; background: rgba(17, 12, 26, .45); opacity: 0; transition: opacity .2s; }
.aff-pwa-panel { position: relative; width: 100%; max-width: 460px; background: #fff; color: #1f1a29; border-radius: 20px 20px 0 0; padding: 20px 20px calc(18px + env(safe-area-inset-bottom)); box-shadow: 0 -10px 40px rgba(0,0,0,.18); transform: translateY(24px); opacity: 0; transition: transform .22s ease, opacity .22s ease; }
.aff-pwa-sheet.is-open .aff-pwa-backdrop { opacity: 1; }
.aff-pwa-sheet.is-open .aff-pwa-panel { transform: none; opacity: 1; }
@media (min-width: 640px) { .aff-pwa-sheet { align-items: center; } .aff-pwa-panel { border-radius: 20px; } }
.aff-pwa-head { display: flex; gap: 12px; align-items: flex-start; }
.aff-pwa-head img { border-radius: 12px; flex: none; }
.aff-pwa-head h3 { margin: 0 0 3px; font-size: 17px; font-weight: 700; }
.aff-pwa-head p { margin: 0; font-size: 13.5px; color: #6b6478; line-height: 1.45; }
.aff-pwa-head .aff-pwa-x { margin: -4px -6px 0 auto; }
.aff-pwa-lead { margin: 14px 0 0; font-size: 14px; color: #3b3446; line-height: 1.5; }
.aff-pwa-steps { list-style: none; margin: 16px 0 0; padding: 0; }
.aff-pwa-steps li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid #f1edf6; font-size: 15px; line-height: 1.4; }
.aff-pwa-steps li:first-child { border-top: 0; }
.aff-pwa-num { flex: none; width: 26px; height: 26px; border-radius: 50%; background: #673ab7; color: #fff; font-weight: 700; font-size: 13px; display: flex; align-items: center; justify-content: center; }
.aff-pwa-txt { flex: 1; min-width: 0; }
.aff-pwa-txt b { color: #1f1a29; }
.aff-pwa-key { flex: none; width: 40px; height: 40px; border-radius: 11px; border: 1px solid #e6def3; background: #faf8fd; display: flex; align-items: center; justify-content: center; }
.aff-pwa-tip { margin: 14px 0 0; padding: 12px 14px; border-radius: 14px; background: #f6f1fd; border: 1px solid #e4d8f7; display: flex; align-items: center; gap: 12px; }
.aff-pwa-tip p { margin: 0; flex: 1; font-size: 14px; line-height: 1.45; color: #3b3446; }
.aff-pwa-tip .aff-pwa-btn { text-decoration: none; flex: none; }
.aff-pwa-or { margin: 14px 0 0; font-size: 13px; color: #8b8496; }
.aff-pwa-note { margin: 10px 0 0; font-size: 13px; color: #6b6478; line-height: 1.5; }
.aff-pwa-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.aff-pwa-actions .aff-pwa-btn { flex: 1; max-width: 200px; padding: 12px 16px; }
/* iPhone Safari: the Share button is in the bottom bar, point at it */
.aff-pwa-pointer { display: none; }
@media (max-width: 639px) { .aff-pwa-ios .aff-pwa-pointer { display: block; position: absolute; left: 50%; bottom: -10px; width: 18px; height: 18px; background: #fff; transform: translateX(-50%) rotate(45deg); } }

/* Install card at the bottom of a page */
.aff-pwa-chip { position: fixed; z-index: 10040; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(560px, calc(100% - 24px)); display: flex; align-items: center; gap: 12px; padding: 12px 10px 12px 14px; background: #fff; color: #1f1a29; border: 1px solid #ece6f4; border-radius: 16px; box-shadow: 0 12px 40px rgba(40, 20, 80, .16); animation: aff-pwa-up .3s ease both; }
.aff-pwa-chip img { border-radius: 9px; flex: none; }
.aff-pwa-chip div { flex: 1; min-width: 0; }
.aff-pwa-chip b { display: block; font-size: 14px; }
.aff-pwa-chip span { display: block; font-size: 12.5px; color: #6b6478; line-height: 1.35; margin-top: 2px; }
@media (max-width: 420px) { .aff-pwa-chip span { display: none; } }
@keyframes aff-pwa-up { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* "Turn on notifications?" inside a page */
.aff-pwa-ask { display: flex; align-items: center; gap: 12px; margin: 12px 0; padding: 12px 10px 12px 14px; background: #faf7ff; border: 1px solid #e9dffa; border-radius: 14px; color: #1f1a29; }
.aff-pwa-ask div { flex: 1; min-width: 0; }
.aff-pwa-ask b { display: block; font-size: 14px; }
.aff-pwa-ask span:not(.aff-pwa-bell) { display: block; font-size: 12.5px; color: #6b6478; line-height: 1.4; margin-top: 2px; }
.aff-pwa-bell { font-size: 20px; flex: none; }

.aff-pwa-toast { position: fixed; z-index: 10060; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 10px); max-width: calc(100% - 32px); background: #1f1a29; color: #fff; padding: 11px 16px; border-radius: 12px; font-size: 14px; line-height: 1.4; opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; }
.aff-pwa-toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* Account page: notification settings */
.aff-notify-card { background: #fff; border: 1px solid #eee9f4; border-radius: 16px; padding: 20px; }
.aff-notify-card h3 { margin: 0 0 4px; font-size: 17px; font-weight: 700; color: #1f1a29; display: flex; align-items: center; gap: 8px; }
.aff-notify-card > p { margin: 0 0 14px; color: #6b6478; font-size: 14px; }
.aff-notify-status { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 14px; border-radius: 12px; background: #f8f6fb; margin-bottom: 14px; font-size: 14px; }
.aff-notify-status .dot { width: 9px; height: 9px; border-radius: 50%; background: #a8a2b3; }
.aff-notify-status.is-on .dot { background: #16a34a; }
.aff-notify-status .txt { flex: 1; min-width: 180px; color: #3b3446; }
.aff-notify-list { list-style: none; margin: 0; padding: 0; }
.aff-notify-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 2px; border-top: 1px solid #f3f0f7; font-size: 14.5px; color: #2b2536; }
.aff-switch { position: relative; width: 42px; height: 24px; flex: none; }
.aff-switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.aff-switch span { position: absolute; inset: 0; border-radius: 999px; background: #d9d4e0; transition: background .15s; pointer-events: none; }
.aff-switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .15s; }
.aff-switch input:checked + span { background: #673ab7; }
.aff-switch input:checked + span::after { transform: translateX(18px); }
.aff-switch input:focus-visible + span { outline: 3px solid #c4b5fd; outline-offset: 2px; }
.aff-notify-foot { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }

/* What's new on the home page: the last two days of the update log */
.dash-log { display: grid; gap: 12px; }
.dash-log-date { font-size: 12px; font-weight: 700; color: #673ab7; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.dash-log ul { list-style: none; margin: 0; padding: 0; }
.dash-log li { position: relative; padding-left: 14px; }
.dash-log li::before { content: ""; position: absolute; left: 2px; top: .62em; width: 5px; height: 5px; border-radius: 50%; background: #c4b5fd; }
.dash-new-item { display: inline; color: #2b2638; font-size: 14px; line-height: 1.6; text-decoration: none; }
.dash-new-item:hover { color: #673ab7; text-decoration: underline; }

/* Home page banner: clearly visible, one tap, closes for 14 days */
.aff-app-banner { display: flex; align-items: center; gap: 18px; margin: 0 0 18px; padding: 18px 20px; border-radius: 20px; color: #fff;
  background: radial-gradient(120% 140% at 0% 0%, #8b5cf6 0%, #673ab7 45%, #4c1d95 100%); box-shadow: 0 14px 40px rgba(103, 58, 183, .28); position: relative; overflow: hidden; }
.aff-app-banner[hidden] { display: none; }
.aff-app-banner::after { content: ''; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px; border-radius: 50%; background: rgba(255,255,255,.08); pointer-events: none; }
.aff-app-phone { flex: none; width: 74px; height: 74px; border-radius: 20px; background: rgba(255,255,255,.14); display: flex; align-items: center; justify-content: center; }
.aff-app-phone img { border-radius: 14px; box-shadow: 0 6px 18px rgba(0,0,0,.25); }
.aff-app-copy { flex: 1; min-width: 0; }
.aff-app-copy h2 { margin: 0 0 4px; font-size: 19px; font-weight: 800; letter-spacing: -0.01em; color: #fff; }
.aff-app-copy p { margin: 0; font-size: 14px; line-height: 1.45; color: rgba(255,255,255,.88); }
.aff-app-actions { display: flex; align-items: center; gap: 6px; flex: none; z-index: 1; }
.aff-app-cta { background: #fff !important; color: #4c1d95 !important; border-color: #fff !important; font-size: 15px !important; padding: 12px 20px !important; box-shadow: 0 6px 16px rgba(0,0,0,.18); }
.aff-app-cta:hover { background: #f5f0ff !important; }
.aff-app-banner .aff-pwa-x { color: rgba(255,255,255,.75); }
.aff-app-banner .aff-pwa-x:hover { background: rgba(255,255,255,.14); color: #fff; }
@media (max-width: 640px) {
  .aff-app-banner { flex-wrap: wrap; gap: 12px; padding: 16px; }
  .aff-app-phone { width: 56px; height: 56px; border-radius: 16px; }
  .aff-app-phone img { width: 42px; height: 42px; border-radius: 11px; }
  .aff-app-copy { flex-basis: calc(100% - 70px); }
  .aff-app-copy h2 { font-size: 17px; }
  .aff-app-actions { width: 100%; }
  .aff-app-cta { flex: 1; }
  .aff-app-banner .aff-pwa-x { position: absolute; top: 8px; right: 8px; }
}

/* Top bar "Cài app" button */
.aff-header-install { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 12px; border-radius: 12px; border: 1px solid #e4d8f7; background: #f6f1fd; color: #5b2ea8; font-weight: 700; font-size: 13.5px; cursor: pointer; }
.aff-header-install:hover { background: #ede3fb; }
.aff-header-install svg { width: 18px; height: 18px; }
@media (max-width: 640px) { .aff-header-install { width: 38px; padding: 0; justify-content: center; } }

/* Installed on this phone but opened in the browser: the top bar button helps find the app instead. */
.aff-app-installed .aff-header-install { background: #fff; }
