/*
 * App design of the user panel, after the imran360 Notes app: mobile first, a tab bar on the
 * phone that becomes a sidebar on a computer. Two styles (Compact, the default, and Classic),
 * each light and dark. appui.js sets <html data-style data-theme> and the accent
 * (--accent-l / --accent-d) before the page draws. Every class starts with "ap-" so it never
 * meets a Bootstrap class; Bootstrap's own colours are taken from the same tokens below.
 * Colours, corners and shadows always come from these variables, so both styles follow.
 */
@font-face { font-family: 'JetBrains Mono'; font-weight: 400; font-display: swap; src: url('../fonts/jetbrains-mono-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'JetBrains Mono'; font-weight: 600; font-display: swap; src: url('../fonts/jetbrains-mono-latin-600-normal.woff2') format('woff2'); }

/* ---------- Classic ---------- */
:root {
    --bg: #f6f7fb;
    --surface: #ffffff;
    --surface-2: #f1f2f7;
    --ap-text: #111827;
    --ap-muted: #6b7280;
    --line: #e6e8ef;
    --accent: var(--accent-l, #4f46e5);
    --accent-soft: color-mix(in srgb, var(--accent) 13%, transparent);
    --on-accent: #ffffff;
    --danger: #e11d48;
    --warning: #d97706;
    --info: #0284c7;
    --violet: #7c3aed;
    --in: #059669;
    --out: #e11d48;
    --ap-shadow: 0 1px 2px rgba(17, 24, 39, .05), 0 4px 14px rgba(17, 24, 39, .05);
    --radius: 16px;
    --radius-sm: 12px;
    --tabbar-h: 64px;
    --side-w: 248px;
    --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, 'Noto Sans Bengali', monospace;
    color-scheme: light;
}
:root[data-theme="dark"] {
    --bg: #0d0f14;
    --surface: #161922;
    --surface-2: #1e222d;
    --ap-text: #eef0f6;
    --ap-muted: #9aa1b2;
    --line: #262b37;
    --accent: var(--accent-d, #818cf8);
    --on-accent: #0d0f14;
    --ap-shadow: 0 1px 2px rgba(0, 0, 0, .3);
    color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0d0f14;
        --surface: #161922;
        --surface-2: #1e222d;
        --ap-text: #eef0f6;
        --ap-muted: #9aa1b2;
        --line: #262b37;
        --accent: var(--accent-d, #818cf8);
        --on-accent: #0d0f14;
        --ap-shadow: 0 1px 2px rgba(0, 0, 0, .3);
        color-scheme: dark;
    }
}

/* ---------- Compact: smaller, sharper, one accent ---------- */
:root[data-style="compact"] {
    --bg: #f7f7f5;
    --surface: #ffffff;
    --surface-2: #f1f1ee;
    --ap-text: #1b1b1a;
    --ap-muted: #5d5d58;
    --line: #e2e2de;
    --accent: var(--accent-l, #c2410c);
    --on-accent: #ffffff;
    --ap-shadow: none;
    --radius: 8px;
    --radius-sm: 8px;
    --tabbar-h: 58px;
    color-scheme: light;
}
:root[data-style="compact"][data-theme="dark"] {
    --bg: #0b0b0b;
    --surface: #121212;
    --surface-2: #1a1a1a;
    --ap-text: #e9e7e3;
    --ap-muted: #a29f99;
    --line: #2a2a2a;
    --accent: var(--accent-d, #f5a524);
    --on-accent: #0b0b0b;
    --ap-shadow: none;
    color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
    :root[data-style="compact"]:not([data-theme="light"]) {
        --bg: #0b0b0b;
        --surface: #121212;
        --surface-2: #1a1a1a;
        --ap-text: #e9e7e3;
        --ap-muted: #a29f99;
        --line: #2a2a2a;
        --accent: var(--accent-d, #f5a524);
        --on-accent: #0b0b0b;
        --ap-shadow: none;
        color-scheme: dark;
    }
}

/* Bootstrap (forms, tables, modals inside the pages) in the same colours. */
:root {
    --bs-body-bg: var(--surface);
    --bs-body-color: var(--ap-text);
    --bs-secondary-color: var(--ap-muted);
    --bs-border-color: var(--line);
    --bs-secondary-bg: var(--surface-2);
    --bs-tertiary-bg: var(--surface-2);
    --bs-emphasis-color: var(--ap-text);
    --bs-link-color: var(--accent);
    --bs-link-hover-color: var(--accent);
    --bs-link-color-rgb: var(--accent);
    --bs-border-radius: var(--radius-sm);
    --bs-border-radius-lg: var(--radius);
    --bs-heading-color: var(--ap-text);
}
.table { --bs-table-bg: transparent; --bs-table-color: var(--ap-text); --bs-table-border-color: var(--line); }
.modal { --bs-modal-bg: var(--surface); --bs-modal-color: var(--ap-text); --bs-modal-border-color: var(--line); --bs-modal-border-radius: var(--radius); }
.form-control, .form-select { background-color: var(--surface-2); border-color: var(--line); color: var(--ap-text); }
.form-control:focus, .form-select:focus { background-color: var(--surface); border-color: var(--accent); color: var(--ap-text); box-shadow: none; }
.btn-primary, .btn--base { --bs-btn-bg: var(--accent); --bs-btn-border-color: var(--accent); --bs-btn-hover-bg: var(--accent); --bs-btn-hover-border-color: var(--accent); --bs-btn-color: var(--on-accent); --bs-btn-hover-color: var(--on-accent); }

/* ---------- Base ---------- */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ap-text); }
body.ap-body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans Bengali", Helvetica, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
}
.ap-body a { color: inherit; text-decoration: none; }
.ap-body button { font: inherit; color: inherit; }
.ap-num { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.ap-muted { color: var(--ap-muted); font-size: 14px; }
.ap-in { color: var(--in) !important; }
.ap-out { color: var(--out) !important; }

/* Page changes fade instead of flashing white; the bars stay put. */
@view-transition { navigation: auto; }
.ap-topbar { view-transition-name: ap-topbar; }
.ap-tabbar { view-transition-name: ap-tabbar; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .16s; }
@media (prefers-reduced-motion: reduce) { @view-transition { navigation: none; } }

.ap-app { max-width: 640px; margin: 0 auto; min-height: 100vh; position: relative; }

/* ---------- Top bar ---------- */
.ap-topbar {
    position: sticky; top: 0; z-index: 20;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: saturate(1.6) blur(14px);
    -webkit-backdrop-filter: saturate(1.6) blur(14px);
    padding: calc(env(safe-area-inset-top) + 10px) 16px 8px;
}
.ap-topbar-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; }
.ap-topbar-title { font-size: 26px; font-weight: 800; letter-spacing: -.02em; margin: 0; line-height: 1.15; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-topbar-actions { display: flex; gap: 4px; flex-shrink: 0; }
.ap-icon-btn { width: 40px; height: 40px; border-radius: var(--radius-sm); display: grid; place-items: center; font-size: 18px; color: var(--ap-muted); flex-shrink: 0; background: none; border: 0; position: relative; }
.ap-icon-btn:active, .ap-icon-btn:hover { background: var(--surface-2); color: var(--ap-text); }
.ap-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-size: 14px; font-weight: 700; flex-shrink: 0; }
.ap-avatar.lg { width: 52px; height: 52px; font-size: 20px; }

/* ---------- Content ---------- */
.ap-content { padding: 8px 16px calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 32px); }
.ap-hello { margin: 0 0 12px; color: var(--ap-muted); font-size: 15px; }
.ap-hello b { color: var(--ap-text); }
.ap-section { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 18px 2px 8px; }
.ap-section h2 { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ap-muted); margin: 0; }
.ap-link { color: var(--accent); font-size: 13.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 2px; }

/* ---------- Cards and lists ---------- */
.ap-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--ap-shadow); margin-bottom: 12px; overflow: hidden; }
:root[data-style="compact"] .ap-card, :root[data-style="compact"] .ap-stat { border: 1px solid var(--line); }
.ap-card-pad { padding: 14px 16px 16px; }
.ap-list-head { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ap-muted); padding: 14px 16px 4px; display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.ap-list-head .ap-link { text-transform: none; letter-spacing: 0; font-size: 13px; }
.ap-list-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 13px 16px; border-top: 1px solid var(--line); text-align: left; font-size: 15px; background: none; border-left: 0; border-right: 0; border-bottom: 0; }
.ap-list-row:first-child, .ap-list-head + .ap-list-row { border-top: 0; }
a.ap-list-row:hover, button.ap-list-row:hover { background: var(--surface-2); }
.ap-list-row > i:first-child { font-size: 18px; color: var(--accent); width: 22px; text-align: center; flex-shrink: 0; }
.ap-list-row .ap-grow { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ap-list-row .ap-sub { font-size: 12.5px; color: var(--ap-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-list-row .ap-end { margin-left: auto; color: var(--ap-muted); font-size: 14px; white-space: nowrap; }
.ap-list-row b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.ap-list-row.danger, .ap-list-row.danger i { color: var(--danger) !important; }

/* ---------- Numbers ---------- */
.ap-stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 12px; }
.ap-stat { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 12px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--ap-shadow); min-width: 0; }
a.ap-stat:active { transform: scale(.98); }
.ap-stat > i { font-size: 17px; color: var(--accent); margin-bottom: 4px; }
.ap-stat-num { font-family: var(--mono); font-size: 19px; font-weight: 600; line-height: 1.15; font-variant-numeric: tabular-nums; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-stat-label { font-size: 12px; color: var(--ap-muted); line-height: 1.25; }
.ap-stat .ap-sub { font-size: 11.5px; color: var(--ap-muted); }

.ap-summary { padding: 16px 16px 14px; }
.ap-big-amount { font-family: var(--mono); font-size: 30px; font-weight: 600; letter-spacing: -.02em; margin: 2px 0 12px; font-variant-numeric: tabular-nums; }
.ap-split { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.ap-split.three { grid-template-columns: repeat(3, 1fr); }
.ap-split > div { display: flex; flex-direction: column; background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px 12px; min-width: 0; }
.ap-split b { font-family: var(--mono); font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-split .ap-muted { font-size: 12px; }

.ap-progress { height: 6px; border-radius: 6px; background: var(--surface-2); overflow: hidden; margin: 6px 0 2px; }
.ap-progress span { display: block; height: 100%; border-radius: 6px; background: var(--accent); transition: width .4s; }
.ap-progress span.in { background: var(--in); }

/* ---------- Wallets: a row you can scroll sideways on the phone ---------- */
.ap-wallets { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(200px, 72%); gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -16px 12px; padding: 2px 16px 4px; scrollbar-width: none; }
.ap-wallets::-webkit-scrollbar { display: none; }
.ap-wallet { scroll-snap-align: start; background: var(--surface); border-radius: var(--radius); box-shadow: var(--ap-shadow); padding: 14px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
:root[data-style="compact"] .ap-wallet { border: 1px solid var(--line); }
.ap-wallet .ap-stat-label { display: flex; align-items: center; gap: 6px; }
.ap-wallet .ap-amount { font-family: var(--mono); font-size: 21px; font-weight: 600; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-wallet-actions { display: flex; gap: 6px; margin-top: 8px; }

/* ---------- Buttons ---------- */
.ap-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 44px; padding: 0 18px; border-radius: var(--radius-sm); background: var(--accent); color: var(--on-accent) !important; font-weight: 700; font-size: 15px; border: 0; white-space: nowrap; }
.ap-btn:hover { filter: brightness(1.06); }
.ap-btn.full { width: 100%; }
.ap-btn.ghost { background: var(--surface-2); color: var(--ap-text) !important; }
.ap-btn-small { display: inline-flex; align-items: center; justify-content: center; gap: 5px; height: 34px; padding: 0 12px; border-radius: 10px; background: var(--accent); color: var(--on-accent) !important; font-weight: 700; font-size: 13.5px; border: 0; flex-shrink: 0; white-space: nowrap; }
:root[data-style="compact"] .ap-btn-small { border-radius: 6px; }
.ap-btn-small.ghost { background: var(--surface-2); color: var(--ap-text) !important; }
.ap-quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; }
.ap-quick a { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 4px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--ap-shadow); font-size: 12.5px; font-weight: 600; text-align: center; }
:root[data-style="compact"] .ap-quick a { border: 1px solid var(--line); }
.ap-quick i { width: 38px; height: 38px; border-radius: var(--radius-sm); display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-size: 18px; }

/* ---------- Notices ---------- */
.ap-alert { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border-radius: var(--radius); margin-bottom: 10px; background: var(--surface); border: 1px solid var(--line); border-left-width: 4px; font-size: 14px; }
.ap-alert > i { font-size: 18px; margin-top: 1px; }
.ap-alert .ap-grow { flex: 1; min-width: 0; }
.ap-alert b { display: block; }
.ap-alert a { color: var(--accent); font-weight: 700; white-space: nowrap; }
.ap-alert.success { border-left-color: var(--in); } .ap-alert.success > i { color: var(--in); }
.ap-alert.warning { border-left-color: var(--warning); } .ap-alert.warning > i { color: var(--warning); }
.ap-alert.info { border-left-color: var(--info); } .ap-alert.info > i { color: var(--info); }
.ap-alert.violet { border-left-color: var(--violet); } .ap-alert.violet > i { color: var(--violet); }
.ap-badge { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); flex-shrink: 0; white-space: nowrap; }
.ap-badge.ok { background: color-mix(in srgb, var(--in) 14%, transparent); color: var(--in); }
.ap-badge.off { background: var(--surface-2); color: var(--ap-muted); }

/* ---------- Copy field ---------- */
.ap-copy { display: flex; gap: 8px; align-items: center; }
.ap-copy input { flex: 1; min-width: 0; height: 40px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ap-text); border-radius: var(--radius-sm); padding: 0 12px; font: inherit; font-size: 13.5px; outline: 0; }

/* ---------- Transactions ---------- */
.ap-tx-row { display: flex; align-items: center; gap: 12px; padding: 11px 16px; border-top: 1px solid var(--line); }
.ap-tx-row:first-child, .ap-list-head + .ap-tx-row { border-top: 0; }
.ap-tx-icon { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; flex-shrink: 0; font-size: 16px; background: var(--surface-2); color: var(--ap-muted); }
.ap-tx-icon.in { background: color-mix(in srgb, var(--in) 14%, transparent); color: var(--in); }
.ap-tx-icon.out { background: color-mix(in srgb, var(--out) 12%, transparent); color: var(--out); }
.ap-tx-row .ap-grow { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ap-tx-row .ap-title { font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-tx-row .ap-sub { font-size: 12px; color: var(--ap-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-tx-amt { display: flex; flex-direction: column; align-items: flex-end; white-space: nowrap; font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 14px; }
.ap-tx-amt .ap-sub { font-family: inherit; }
.ap-empty { text-align: center; color: var(--ap-muted); padding: 28px 16px; }
.ap-empty i { font-size: 32px; color: var(--accent); opacity: .8; display: block; margin-bottom: 6px; }

/* ---------- Tab bar (phone) ---------- */
.ap-tabbar {
    position: fixed; z-index: 30; bottom: 0; left: 50%; transform: translateX(-50%);
    width: 100%; max-width: 640px;
    display: grid; grid-template-columns: repeat(7, 1fr);
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: color-mix(in srgb, var(--surface) 90%, transparent);
    backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px);
    border-top: 1px solid var(--line);
}
.ap-body .ap-tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px; font-weight: 600; min-width: 0; padding: 0; color: var(--ap-muted) !important; background: none; border: 0; position: relative; }
.ap-tab i { font-size: 20px; }
.ap-tab.active { color: var(--accent) !important; }
.ap-tab span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; letter-spacing: -.02em; }
@media (max-width: 440px) { .ap-body .ap-tab span { font-size: 10px; } }
.ap-tab-badge { position: absolute; top: 6px; left: calc(50% + 6px); min-width: 17px; height: 17px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; }
.ap-side { display: none; }

/* ---------- Sheets ---------- */
.ap-sheet-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(10, 12, 20, .45); opacity: 0; pointer-events: none; transition: opacity .2s; }
.ap-sheet {
    position: fixed; z-index: 50; left: 50%; bottom: 0; transform: translate(-50%, 105%);
    width: 100%; max-width: 640px; max-height: 88vh; overflow-y: auto; overscroll-behavior: contain;
    background: var(--bg); border-radius: 22px 22px 0 0;
    padding: 8px 14px calc(18px + env(safe-area-inset-bottom));
    box-shadow: 0 -10px 40px rgba(0, 0, 0, .18);
    transition: transform .26s cubic-bezier(.2, .8, .2, 1);
    visibility: hidden;
}
.ap-sheet.open { transform: translate(-50%, 0); visibility: visible; }
.ap-sheet-backdrop.open { opacity: 1; pointer-events: auto; }
.ap-grabber { width: 38px; height: 5px; border-radius: 5px; background: var(--line); margin: 2px auto 8px; }
.ap-sheet-head { display: flex; align-items: center; justify-content: space-between; margin: 0 2px 8px; }
.ap-sheet-head h2 { font-size: 18px; font-weight: 700; margin: 0; }
body.ap-sheet-open { overflow: hidden; }

/* ---------- Appearance picker ---------- */
.ap-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 0 16px 12px; }
.ap-pick.two { grid-template-columns: repeat(2, 1fr); }
.ap-pick button { height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); font-size: 14px; font-weight: 600; color: var(--ap-text); }
.ap-pick button.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.ap-swatches { display: flex; gap: 10px; flex-wrap: wrap; padding: 2px 16px 16px; }
.ap-swatches button { width: 32px; height: 32px; border-radius: 50%; border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--line); display: grid; place-items: center; font-size: 13px; font-weight: 700; color: var(--ap-muted); background: var(--surface-2); }
.ap-swatches button.active { box-shadow: 0 0 0 2px var(--ap-text); }

/* ---------- Toast ---------- */
.ap-toast {
    position: fixed; z-index: 60; left: 50%; transform: translateX(-50%);
    bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 18px);
    background: #1f2330; color: #fff; padding: 11px 16px; border-radius: 12px; font-size: 14px; font-weight: 500;
    box-shadow: 0 8px 28px rgba(0, 0, 0, .25); max-width: calc(100% - 32px);
    opacity: 0; pointer-events: none; transition: opacity .2s;
}
.ap-toast.show { opacity: 1; }

@media (max-width: 380px) {
    .ap-body .ap-tab span { font-size: 9.5px; }
    .ap-quick { gap: 6px; }
    .ap-quick a { font-size: 11px; padding: 10px 2px; }
    .ap-split.three { grid-template-columns: 1fr 1fr; }
}

/* ---------- Computer: a sidebar instead of the tab bar, and wider pages ---------- */
@media (min-width: 960px) {
    .ap-app { max-width: none; padding-left: var(--side-w); }
    .ap-topbar, .ap-content { max-width: 1120px; margin: 0 auto; padding-left: 32px; padding-right: 32px; }
    .ap-topbar { padding-top: 22px; background: var(--bg); backdrop-filter: none; -webkit-backdrop-filter: none; }
    .ap-content { padding-bottom: 80px; }
    .ap-tabbar { display: none; }

    .ap-side {
        position: fixed; z-index: 30; left: 0; top: 0; bottom: 0; width: var(--side-w);
        display: flex; flex-direction: column; gap: 2px; padding: 20px 12px 12px; overflow-y: auto;
        border-right: 1px solid var(--line); background: var(--surface);
        view-transition-name: ap-side;
    }
    .ap-side-brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; font-size: 19px; font-weight: 800; letter-spacing: -.01em; }
    .ap-side-brand img { max-height: 32px; max-width: 150px; }
    .ap-side-group { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ap-muted); padding: 14px 12px 4px; }
    .ap-side-link { display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 12px; border-radius: var(--radius-sm); font-size: 14.5px; font-weight: 600; color: var(--ap-muted) !important; flex-shrink: 0; }
    .ap-side-link i { font-size: 17px; width: 20px; text-align: center; }
    .ap-side-link:hover { background: var(--surface-2); color: var(--ap-text) !important; }
    .ap-side-link.active { background: var(--accent-soft); color: var(--accent) !important; }
    .ap-side-link .ap-tab-badge { position: static; margin-left: auto; }
    .ap-side-foot { display: flex; align-items: center; gap: 10px; margin-top: auto; padding: 14px 8px 4px; border-top: 1px solid var(--line); font-size: 14px; }
    .ap-side-foot .ap-grow { display: flex; flex-direction: column; min-width: 0; flex: 1; }
    .ap-side-foot b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .ap-side-foot .ap-sub { font-size: 12px; color: var(--ap-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

    .ap-stat-grid { grid-template-columns: repeat(4, 1fr); }
    .ap-wallets { grid-auto-flow: row; grid-auto-columns: auto; grid-template-columns: repeat(3, 1fr); overflow: visible; margin: 0 0 12px; padding: 0; }
    .ap-quick { grid-template-columns: repeat(8, 1fr); }
    .ap-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 16px; align-items: start; }
    .ap-cols.wide-left { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }

    /* Sheets open as a dialog in the middle of the page */
    .ap-sheet {
        top: 50%; bottom: auto; left: calc(var(--side-w) + (100vw - var(--side-w)) / 2);
        transform: translate(-50%, -46%) scale(.98); opacity: 0;
        max-width: 560px; max-height: 86vh; border-radius: 20px; padding: 16px 18px 18px;
        box-shadow: 0 24px 60px rgba(0, 0, 0, .25);
        transition: transform .18s ease-out, opacity .18s ease-out, visibility .18s;
    }
    .ap-sheet.open { transform: translate(-50%, -50%); opacity: 1; }
    .ap-grabber { display: none; }
    .ap-toast { bottom: 40px; left: calc(var(--side-w) + (100vw - var(--side-w)) / 2); }
}
@media (min-width: 1500px) {
    .ap-topbar, .ap-content { max-width: 1280px; }
}

/* ---------- Sign-in pages (login, register, password, verification) ----------
   Their markup is the active template's; only the look comes from here. */
.ap-auth-body { min-height: 100vh; }
.ap-auth { max-width: 460px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 28px) 16px 32px; }
.ap-auth:has(.register-card) { max-width: 640px; }
.ap-auth-brand { display: block; text-align: center; font-size: 22px; font-weight: 800; letter-spacing: -.02em; margin-bottom: 18px; color: var(--ap-text) !important; }
.ap-auth-foot { text-align: center; margin: 18px 0 0; font-size: 14px; }
.ap-auth-foot a { color: var(--ap-muted) !important; }

.ap-auth .auth-section, .ap-auth .section-padding { padding: 0 !important; background: none !important; min-height: 0 !important; position: static; }
.ap-auth .auth-bg-shape, .ap-auth .auth-left-content, .ap-auth .auth-mobile-brand { display: none !important; }
.ap-auth .container { max-width: none; padding: 0; }
.ap-auth .row { margin: 0; --bs-gutter-x: 12px; }
.ap-auth .row.min-vh-100 { min-height: 0 !important; --bs-gutter-y: 0; margin-top: 0; }
.ap-auth .row.g-3 .form-group { margin-bottom: 0; }
.ap-auth .row > [class*="col-lg-"], .ap-auth .row > [class*="col-md-7"], .ap-auth .row > [class*="col-md-8"] { flex: 0 0 100%; max-width: 100%; padding: 0; }
.ap-auth .row > .d-none.d-lg-block { display: none !important; }

.ap-auth .auth-card, .ap-auth .ui-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--ap-shadow); padding: 22px 18px !important; border: 0; }
:root[data-style="compact"] .ap-auth .auth-card, :root[data-style="compact"] .ap-auth .ui-card { border: 1px solid var(--line); }
.ap-auth .ui-card-soft { background: var(--surface-2); border-radius: var(--radius-sm); }
.ap-auth .auth-card-header { margin-bottom: 18px; }
.ap-auth .auth-card-header h2, .ap-auth h3 { font-size: 24px; font-weight: 800; letter-spacing: -.02em; margin: 2px 0 4px; color: var(--ap-text) !important; }
.ap-auth .auth-card-header p, .ap-auth .text-muted { color: var(--ap-muted) !important; font-size: 14px; }
.ap-auth .section-kicker { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--accent); }
.ap-auth .text-dark { color: var(--ap-text) !important; }
.ap-auth .rounded-circle[style*="width:7"] { display: flex !important; width: 56px !important; height: 56px !important; font-size: 24px !important; background: var(--accent-soft) !important; color: var(--accent) !important; border-radius: var(--radius) !important; margin: 0 auto 14px !important; }
.ap-auth .ui-card .text-start .section-kicker { display: inline-block; }

.ap-auth .form-group { margin-bottom: 14px; }
.ap-auth label, .ap-auth .form-label { display: block; font-size: 12.5px; font-weight: 700; color: var(--ap-muted); margin-bottom: 6px; }
.ap-auth .custom-check, .ap-auth .custom-check span { font-size: 14px; font-weight: 500; color: var(--ap-text); text-transform: none; letter-spacing: 0; }
.ap-auth .input-icon { position: relative; }
.ap-auth .input-icon > i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--ap-muted); font-size: 16px; pointer-events: none; }
.ap-auth .input-icon input, .ap-auth .input-icon select, .ap-auth input.form-control, .ap-auth select.form-control,
.ap-auth input[name="captcha"] {
    width: 100%; height: 46px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ap-text);
    border-radius: var(--radius-sm); padding: 0 13px; font: inherit; font-size: 15px; outline: 0; appearance: none;
}
.ap-auth .input-icon input, .ap-auth .input-icon select { padding-left: 40px; }
.ap-auth .input-icon:has(.password-toggle) input { padding-right: 46px; }
.ap-auth .input-icon select { background-image: linear-gradient(45deg, transparent 50%, var(--ap-muted) 50%), linear-gradient(135deg, var(--ap-muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.ap-auth input:focus, .ap-auth select:focus { border-color: var(--accent) !important; background-color: var(--surface) !important; box-shadow: none !important; }
.ap-auth .password-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border: 0; background: none; color: var(--ap-muted); border-radius: 10px; display: grid; place-items: center; }
.ap-auth .password-toggle:hover { background: var(--surface); color: var(--ap-text); }
.ap-auth .verification-code-input { width: 46px !important; height: 52px !important; padding: 0 !important; font-family: var(--mono); font-size: 20px; border-radius: var(--radius-sm) !important; }

.ap-auth .auth-options { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 4px 0 16px; font-size: 14px; }
.ap-auth .auth-options a, .ap-auth .auth-bottom-text a, .ap-auth form a { color: var(--accent) !important; font-weight: 600; }
.ap-auth .custom-check { display: inline-flex; align-items: center; gap: 8px; margin: 0; cursor: pointer; }
.ap-auth .custom-check input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }
.ap-auth .auth-submit-btn, .ap-auth .primary-btn, .ap-auth .btn--base, .ap-auth button[type="submit"]:not(.password-toggle) {
    display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 48px; border: 0;
    border-radius: var(--radius-sm); background: var(--accent) !important; color: var(--on-accent) !important; font-weight: 700; font-size: 15.5px;
}
.ap-auth .auth-submit-btn:hover, .ap-auth .primary-btn:hover { filter: brightness(1.06); }
.ap-auth .auth-bottom-text { text-align: center; margin: 16px 0 0; font-size: 14px; color: var(--ap-muted); }
.ap-auth .google-login-block .btn { height: 46px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); color: var(--ap-text); font-weight: 600; }
.ap-auth .google-login-block hr { border-color: var(--line); opacity: 1; }
.ap-auth .alert { border-radius: var(--radius-sm) !important; font-size: 14px; background: var(--surface-2); color: var(--ap-text); border: 1px solid var(--line) !important; }
.ap-auth .alert-success { border-left: 4px solid var(--in) !important; }
.ap-auth .alert-danger { border-left: 4px solid var(--danger) !important; }
.ap-auth .text-success { color: var(--in) !important; }
.ap-auth .text-danger, .ap-auth .error { color: var(--danger) !important; }
.ap-auth .mobile-code { color: var(--accent) !important; }

/* ---------- User pages not built in the app design yet ----------
   Their content and styles are the active template's (loaded before this file); its colour
   variables are mapped to the app design's, so they follow the style, theme and accent. */
body.ap-legacy.dashboard-page {
    --green: var(--accent); --green-dark: var(--accent); --primary-green: var(--accent);
    --dark: var(--ap-text); --dark-2: var(--ap-text);
    --text: var(--ap-text); --muted: var(--ap-muted); --shadow: var(--ap-shadow);
    --card-bg: var(--surface); --body-bg: var(--bg); --light-bg: var(--bg); --border: var(--line);
    background: var(--bg); color: var(--ap-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans Bengali", Helvetica, Arial, sans-serif;
}
body.ap-legacy.dashboard-page .dashboard-content { padding: 0; }
body.ap-legacy .ui-card, body.ap-legacy .ui-card-soft, body.ap-legacy .dashboard-card, body.ap-legacy .welcome-card,
body.ap-legacy .summary-card, body.ap-legacy .wallet-card, body.ap-legacy .deposit-section-card, body.ap-legacy .stat-card,
body.ap-legacy .team-metric-card, body.ap-legacy .card {
    border-radius: var(--radius) !important; background: var(--surface); border-color: var(--line); color: var(--ap-text);
}
body.ap-legacy .ui-card, body.ap-legacy .dashboard-card, body.ap-legacy .welcome-card, body.ap-legacy .summary-card,
body.ap-legacy .wallet-card, body.ap-legacy .deposit-section-card, body.ap-legacy .card { box-shadow: var(--ap-shadow); }
body.ap-legacy .ui-hover-card:hover { transform: none; }
body.ap-legacy h1, body.ap-legacy h2, body.ap-legacy h3, body.ap-legacy h4, body.ap-legacy h5, body.ap-legacy h6 { color: var(--ap-text); }
body.ap-legacy .text-muted { color: var(--ap-muted) !important; }
body.ap-legacy .text-dark { color: var(--ap-text) !important; }
body.ap-legacy .bg-white, body.ap-legacy .bg-light { background: var(--surface) !important; }
body.ap-legacy .list-group-item { background: transparent; color: var(--ap-text); border-color: var(--line); }
body.ap-legacy .primary-btn, body.ap-legacy .btn--base, body.ap-legacy .btn-main {
    background: var(--accent) !important; color: var(--on-accent) !important; border: 0; border-radius: var(--radius-sm);
}
body.ap-legacy .outline-btn { border-color: var(--line) !important; color: var(--ap-text) !important; background: var(--surface) !important; border-radius: var(--radius-sm); }
body.ap-legacy .form-control, body.ap-legacy .form-select, body.ap-legacy .form--control, body.ap-legacy .input-group-text {
    background-color: var(--surface-2); border-color: var(--line); color: var(--ap-text); border-radius: var(--radius-sm);
}
body.ap-legacy .table { --bs-table-bg: transparent; --bs-table-color: var(--ap-text); --bs-table-striped-bg: var(--surface-2); --bs-table-hover-bg: var(--surface-2); color: var(--ap-text); }
body.ap-legacy .table thead th { color: var(--ap-muted); background: var(--surface-2); border-color: var(--line); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
body.ap-legacy .table td { border-color: var(--line); }
body.ap-legacy .modal-content { background: var(--surface); color: var(--ap-text); border-radius: var(--radius); border-color: var(--line); }
body.ap-legacy .card-kicker, body.ap-legacy .ui-card-kicker { color: var(--accent); }
body.ap-legacy .inner-page-header { margin-bottom: 14px; }
/* Wide tables scroll inside their card instead of widening the page (appui.js wraps them). */
.ap-content { min-width: 0; }
body.ap-legacy .ap-table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
body.ap-legacy .ap-table-scroll > .table { min-width: 560px; }
/* Status badges the models print ("badge--success" ...), in the design's colours, on every page. */
.ap-body .badge[class*="badge--"] { background: var(--accent-soft); color: var(--accent); font-weight: 700; border-radius: 999px; }
.ap-body .badge--success { background: color-mix(in srgb, var(--in) 14%, transparent) !important; color: var(--in) !important; }
.ap-body .badge--danger { background: color-mix(in srgb, var(--danger) 13%, transparent) !important; color: var(--danger) !important; }
.ap-body .badge--warning { background: color-mix(in srgb, var(--warning) 15%, transparent) !important; color: var(--warning) !important; }
.ap-body .badge--info, .ap-body .badge--primary { background: color-mix(in srgb, var(--info) 13%, transparent) !important; color: var(--info) !important; }
.ap-body .badge--dark, .ap-body .badge--secondary { background: var(--surface-2) !important; color: var(--ap-muted) !important; }

/* The template gives many boxes a fixed white background; here they take the design's
   surfaces, so they stay white in light and turn dark in dark. Small coloured badges keep theirs. */
body.ap-legacy.dashboard-page .binary-placement-switch,
body.ap-legacy.dashboard-page .binary-tree-card,
body.ap-legacy.dashboard-page .broker-btn,
body.ap-legacy.dashboard-page .broker-card,
body.ap-legacy.dashboard-page .broker-modal-warning,
body.ap-legacy.dashboard-page .broker-summary-card,
body.ap-legacy.dashboard-page .broker-tab,
body.ap-legacy.dashboard-page .connected-broker-actions button:last-child,
body.ap-legacy.dashboard-page .connected-broker-card,
body.ap-legacy.dashboard-page .copy-actions button:last-child,
body.ap-legacy.dashboard-page .copy-box,
body.ap-legacy.dashboard-page .copy-warning,
body.ap-legacy.dashboard-page .dashboard-card,
body.ap-legacy.dashboard-page .deposit-section-card,
body.ap-legacy.dashboard-page .inner-page-header,
body.ap-legacy.dashboard-page .mini-module-card,
body.ap-legacy.dashboard-page .notification-item,
body.ap-legacy.dashboard-page .outline-btn,
body.ap-legacy.dashboard-page .p2p-method-card,
body.ap-legacy.dashboard-page .portfolio-btn,
body.ap-legacy.dashboard-page .portfolio-card,
body.ap-legacy.dashboard-page .portfolio-summary-card,
body.ap-legacy.dashboard-page .portfolio-tab,
body.ap-legacy.dashboard-page .rank-card,
body.ap-legacy.dashboard-page .rank-gap-card,
body.ap-legacy.dashboard-page .rank-ladder-card,
body.ap-legacy.dashboard-page .rank-requirement-card,
body.ap-legacy.dashboard-page .referral-box,
body.ap-legacy.dashboard-page .security-qr,
body.ap-legacy.dashboard-page .signal-note,
body.ap-legacy.dashboard-page .signal-stat-card,
body.ap-legacy.dashboard-page .signal-subscription-card,
body.ap-legacy.dashboard-page .signal-tab,
body.ap-legacy.dashboard-page .signal-trade-card,
body.ap-legacy.dashboard-page .signal-wallet-card,
body.ap-legacy.dashboard-page .summary-card,
body.ap-legacy.dashboard-page .team-summary-card,
body.ap-legacy.dashboard-page .transaction-card,
body.ap-legacy.dashboard-page .unilevel-level-card,
body.ap-legacy.dashboard-page .unilevel-toggle,
body.ap-legacy.dashboard-page .upload-box,
body.ap-legacy.dashboard-page .wallet-card {
    background: var(--surface) !important; border-color: var(--line) !important; color: var(--ap-text);
}
body.ap-legacy.dashboard-page .copy-grid div,
body.ap-legacy.dashboard-page .p2p-steps div,
body.ap-legacy.dashboard-page .portfolio-search,
body.ap-legacy.dashboard-page .broker-modal input,
body.ap-legacy.dashboard-page .broker-modal select,
body.ap-legacy.dashboard-page .broker-modal textarea,
body.ap-legacy.dashboard-page .form-control,
body.ap-legacy.dashboard-page .form-select,
body.ap-legacy.dashboard-page .dashboard-table tbody tr:hover {
    background: var(--surface-2) !important; border-color: var(--line) !important; color: var(--ap-text);
}
body.ap-legacy.dashboard-page .rank-ladder-card.current, body.ap-legacy.dashboard-page .connected-broker-card.active { border-color: var(--accent) !important; }
body.ap-legacy.dashboard-page .rank-ladder-card.completed { border-color: var(--in) !important; }

/* ---------- Search, filters, pagination ---------- */
.ap-search { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0 6px 0 12px; height: 44px; color: var(--ap-muted); margin-bottom: 10px; }
.ap-search input { flex: 1; border: 0; outline: 0; background: none; color: var(--ap-text); font: inherit; min-width: 0; }
.ap-chips { display: flex; gap: 8px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px 10px; padding: 0 16px 2px; }
.ap-chips::-webkit-scrollbar { display: none; }
.ap-chip { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; height: 34px; padding: 0 13px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 14px; font-weight: 500; color: var(--ap-text) !important; }
.ap-chip.active { background: var(--ap-text); color: var(--bg) !important; border-color: var(--ap-text); }
.ap-chip i { font-size: 13px; }
.ap-field { display: block; margin-bottom: 12px; }
.ap-field > span { display: block; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ap-muted); margin-bottom: 6px; }
.ap-input { width: 100%; height: 44px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ap-text); border-radius: var(--radius-sm); padding: 0 12px; font: inherit; outline: 0; appearance: none; }
select.ap-input { background-image: linear-gradient(45deg, transparent 50%, var(--ap-muted) 50%), linear-gradient(135deg, var(--ap-muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
.ap-input:focus { border-color: var(--accent); background-color: var(--surface); }
.ap-day { font-size: 12.5px; font-weight: 700; color: var(--ap-muted); padding: 12px 16px 4px; }
.ap-day:first-child { padding-top: 14px; }
button.ap-tx-row { width: 100%; background: none; border: 0; border-top: 1px solid var(--line); text-align: left; color: inherit; }
button.ap-tx-row:hover { background: var(--surface-2); }
.ap-pages { margin: 4px 0 16px; }
.ap-body .pagination { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 0; padding: 0; list-style: none; }
.ap-body .page-link { min-width: 38px; height: 38px; display: grid; place-items: center; padding: 0 10px; border-radius: var(--radius-sm) !important; border: 1px solid var(--line); background: var(--surface); color: var(--ap-text); font-weight: 600; }
.ap-body .page-item.active .page-link { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.ap-body .page-item.disabled .page-link { color: var(--ap-muted); background: var(--surface-2); }
.ap-list-row.ap-wrap { align-items: flex-start; }
.ap-list-row.ap-wrap .ap-sub, .ap-list-row.ap-wrap .ap-title { white-space: normal; overflow: visible; }
.ap-list-row.ap-wrap .ap-sub { line-height: 1.45; margin-top: 2px; }

/* ---------- Forms shared with the active template (".ap-form") ----------
   Money forms live in resources/views/partials/user so both designs use the same fields and
   scripts; here they take the app design's look. */
.ap-form .form-group { margin-bottom: 14px; }
.ap-form .form-label, .ap-form label { display: block; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ap-muted); margin-bottom: 6px; }
.ap-form .form-label.d-flex { display: flex !important; }
.ap-form .form-label a, .ap-form label a { text-transform: none; letter-spacing: 0; color: var(--accent); }
.ap-form .form-control, .ap-form .form-select, .ap-form .form--control {
    height: 46px; border: 1px solid var(--line); background-color: var(--surface-2); color: var(--ap-text);
    border-radius: var(--radius-sm); padding: 0 12px; font: inherit; font-size: 15px; box-shadow: none;
}
.ap-form textarea.form-control { height: auto; min-height: 96px; padding: 10px 12px; }
.ap-form input[type="file"].form-control { padding: 9px 12px; }
.ap-form select.form-control, .ap-form .form-select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ap-muted) 50%), linear-gradient(135deg, var(--ap-muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
.ap-form .form-control:focus, .ap-form .form-select:focus { border-color: var(--accent); background-color: var(--surface); box-shadow: none; color: var(--ap-text); }
.ap-form .form-control[readonly] { color: var(--ap-muted); }
.ap-form .input-group > .form-control { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.ap-form .input-group-text { border: 1px solid var(--line); border-left: 0; background: var(--surface-2) !important; color: var(--ap-muted) !important; font-weight: 700; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.ap-form input[name="amount"] { font-family: var(--mono); font-size: 18px; font-weight: 600; }
.ap-form .list-group { border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--line); }
.ap-form .list-group-item { background: var(--surface-2); color: var(--ap-text); border: 0; border-top: 1px solid var(--line); padding: 10px 12px; font-size: 14px; }
.ap-form .list-group-item:first-child { border-top: 0; }
.ap-form .list-group-item .fw-bold { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.ap-form .rate-element > .fw-bold:first-child { font-family: inherit; font-weight: 400 !important; }
.ap-form input[type="number"]::-webkit-outer-spin-button, .ap-form input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.ap-form input[type="number"] { -moz-appearance: textfield; }
.ap-form .primary-btn, .ap-form button[type="submit"] {
    display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 48px; border: 0;
    border-radius: var(--radius-sm); background: var(--accent) !important; color: var(--on-accent) !important; font-weight: 700; font-size: 15.5px;
}
.ap-form .primary-btn:hover { filter: brightness(1.06); }
.ap-form .text-success { color: var(--in) !important; }
.ap-form .text-danger { color: var(--danger) !important; }
.ap-form p, .ap-form .text-center { color: var(--ap-text); }
.ap-form .badge { border-radius: 999px; }

/* ---------- Plans ---------- */
.ap-plans { display: grid; grid-template-columns: 1fr; gap: 0 12px; }
@media (min-width: 700px) { .ap-plans { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1300px) { .ap-plans { grid-template-columns: repeat(3, 1fr); } }
.ap-form .modal-content { background: var(--surface); color: var(--ap-text); border-radius: var(--radius); }
.ap-form .modal-footer .outline-btn { height: 44px; padding: 0 18px; border-radius: var(--radius-sm); background: var(--surface-2); color: var(--ap-text); }
.ap-form .modal-footer .primary-btn { width: auto; padding: 0 22px; height: 44px; }
.ap-form .modal .dashboard-card { background: var(--surface-2); border-radius: var(--radius-sm); padding: 12px; }
.ap-plans .ap-split b { white-space: normal; overflow: visible; }
.ap-badge.warn { background: color-mix(in srgb, var(--warning) 16%, transparent); color: var(--warning); }
.ap-badge.bad { background: color-mix(in srgb, var(--out) 14%, transparent); color: var(--out); }

/* ---------- Key / value rows ---------- */
.ap-kv { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; padding: 11px 16px; border-top: 1px solid var(--line); }
.ap-kv:first-child { border-top: 0; }
.ap-kv > span:first-child { color: var(--ap-muted); flex-shrink: 0; }
.ap-kv > :last-child { text-align: right; min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
.ap-qr { display: block; width: 220px; max-width: 100%; margin: 6px auto 10px; background: #fff; padding: 8px; border-radius: var(--radius-sm); }
a.ap-tx-row { color: inherit; text-decoration: none; }
a.ap-tx-row:hover { background: var(--surface-2); }
.ap-tx-amt .ap-badge { margin-top: 3px; }

/* Legacy pages: compact page headers (the title is already in the top bar). */
body.ap-legacy .welcome-card { padding: 16px 18px !important; min-height: 0 !important; margin-bottom: 14px !important; }
body.ap-legacy .welcome-card .welcome-visual { display: none !important; }
body.ap-legacy .welcome-card h2, body.ap-legacy .inner-page-header h2 { font-size: 20px; margin-bottom: 4px; }
body.ap-legacy .welcome-card p, body.ap-legacy .inner-page-header p { font-size: 13.5px; color: var(--ap-muted); margin-bottom: 0; }
body.ap-legacy .welcome-actions { display: flex !important; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
body.ap-legacy .welcome-actions .primary-btn, body.ap-legacy .welcome-actions .outline-btn { padding: 7px 14px !important; font-size: 13.5px; border-radius: 999px !important; }

/* ---------- Metric grid (label + three numbers) ---------- */
.ap-metric { display: grid; grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr)); gap: 6px; align-items: center; padding: 10px 16px; border-top: 1px solid var(--line); font-size: 14px; }
.ap-metric:first-child { border-top: 0; }
.ap-metric > span:first-child { color: var(--ap-muted); }
.ap-metric > b, .ap-metric > span + span { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; font-weight: 600; overflow-wrap: anywhere; }
.ap-metric-head { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--ap-muted); }
.ap-metric-head > span + span { font-family: inherit; font-weight: 700; }
@media (max-width: 420px) { .ap-metric { font-size: 12.5px; padding: 9px 12px; } }
.ap-form .p2p-notice { border: 1px solid var(--line); border-left: 4px solid var(--in); border-radius: var(--radius-sm); background: var(--surface-2); padding: 12px 14px; }
.ap-form .p2p-notice span { display: block; color: var(--ap-muted); font-size: 12.5px; margin-bottom: 2px; }
.ap-form .p2p-notice strong { display: block; overflow-wrap: anywhere; }
.ap-form .alert-warning { background: color-mix(in srgb, var(--warning) 12%, transparent); color: var(--ap-text); border: 0; border-radius: var(--radius-sm); }
.ap-kv > span:last-child .ap-badge { margin-left: 6px; }
.ap-form .dashboard-card { background: var(--surface-2); border-radius: var(--radius-sm); border: 0; box-shadow: none; }
.ap-form .info-list > div { display: flex; justify-content: space-between; gap: 10px; }
.ap-form .info-list span { color: var(--ap-muted); }
.ap-form .outline-btn { display: inline-flex; align-items: center; justify-content: center; height: 44px; padding: 0 18px; border-radius: var(--radius-sm); background: var(--surface-2); color: var(--ap-text); border: 1px solid var(--line); text-decoration: none; font-weight: 600; }
.ap-form #broker_suggestions .list-group-item { cursor: pointer; }
.ap-form #broker_suggestions .list-group-item:hover, .ap-form #broker_suggestions .list-group-item.active { background: var(--surface); }
.ap-form #broker_suggestions { background: var(--surface) !important; border-color: var(--line) !important; }
.ap-form .alert-danger { background: color-mix(in srgb, var(--out) 12%, transparent); color: var(--ap-text); border: 0; border-radius: var(--radius-sm); }
.ap-form .alert-success { background: color-mix(in srgb, var(--in) 12%, transparent); color: var(--ap-text); border: 0; border-radius: var(--radius-sm); }
.ap-legacy-block { margin-top: 14px; }
.ap-chips > .ap-badge { align-self: center; }
.ap-kv > span:last-child { min-width: 0; }

/* ---------- Chat (support ticket conversation) ---------- */
.ap-chat { display: flex; flex-direction: column; gap: 10px; }
.ap-bubble { max-width: 88%; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.ap-bubble.mine { align-self: flex-end; background: var(--accent-soft); border-color: transparent; }
.ap-bubble-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.ap-bubble p { margin: 0 0 8px; white-space: pre-wrap; overflow-wrap: anywhere; }
.ap-bubble .ap-sub { display: block; font-size: 12px; color: var(--ap-muted); margin-top: 6px; }
.ap-form .input-group .btn-danger { background: var(--out); color: #fff; border: 0; }
.ap-form .upload-box { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 10px 14px; border: 1px dashed var(--line); border-radius: var(--radius-sm); background: var(--surface-2); cursor: pointer; color: var(--ap-muted); }
.ap-form .upload-box i { font-size: 20px; color: var(--accent); }
.ap-form .table { --bs-table-bg: transparent; --bs-table-color: var(--ap-text); color: var(--ap-text); }
.ap-form .table th { color: var(--ap-muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; border-color: var(--line); }
.ap-form .table td { border-color: var(--line); }
.ap-form .small-action-btn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--surface-2); color: var(--ap-text); text-decoration: none; font-size: 13px; font-weight: 600; }
.ap-twofa .security-qr { display: inline-block; background: #fff; padding: 8px; border-radius: var(--radius-sm); }
.ap-twofa .security-qr svg { width: 220px; height: 220px; }
.ap-twofa h3 { font-size: 18px; margin: 10px 0 4px; }
.ap-twofa .copy-box { display: flex; align-items: center; gap: 8px; margin-top: 12px; padding: 8px 8px 8px 12px; background: var(--surface-2); border-radius: var(--radius-sm); }
.ap-twofa .copy-box .referralURL { flex: 1; min-width: 0; overflow-wrap: anywhere; font-family: var(--mono); font-size: 13px; text-align: left; }
.ap-table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
.ap-table-scroll > .table { min-width: 620px; }
.ap-form .badge--dark { color: var(--ap-muted); border: 1px solid var(--line); background: var(--surface-2); padding: 6px 10px; border-radius: 999px; font-weight: 700; font-size: 12px; }
.ap-form .text-bg-success { background: color-mix(in srgb, var(--in) 16%, transparent) !important; color: var(--in) !important; }
.ap-form .text-bg-danger { background: color-mix(in srgb, var(--out) 16%, transparent) !important; color: var(--out) !important; }
.ap-form .modal-header, .ap-form .modal-footer { border-color: var(--line); }
.ap-form .btn-close { filter: var(--ap-close-filter, none); }
.ap-form .btn-main { display: flex; align-items: center; justify-content: center; height: 46px; border: 0; border-radius: var(--radius-sm); background: var(--accent); color: var(--on-accent); font-weight: 700; text-decoration: none; }
.ap-form .btn-main.d-none { display: none !important; }
.ap-form .form-control-sm { height: 40px; }
.ap-split-wrap b { white-space: normal; overflow-wrap: anywhere; }

/* ---------- Offline page ---------- */
.ap-offline { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.ap-offline .ap-card { max-width: 380px; width: 100%; text-align: center; }
.ap-offline h1 { font-size: 20px; margin: 10px 0 6px; color: var(--ap-text); }
.ap-offline-icon { width: 56px; height: 56px; margin: 0 auto; border-radius: 50%; display: grid; place-items: center; font-size: 26px; font-weight: 800; background: var(--accent-soft); color: var(--accent); }

/* ---------- Public landing page ---------- */
.ap-public { background: var(--bg); }
.ap-pub-wrap { max-width: 1160px; margin: 0 auto; padding: 0 16px; }
.ap-pub-narrow { max-width: 820px; }
.ap-pub-top { position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.ap-pub-top .ap-pub-wrap { display: flex; align-items: center; gap: 16px; height: 64px; }
.ap-pub-brand img { height: 30px; width: auto; display: block; }
.ap-pub-nav { display: none; gap: 20px; margin-left: 12px; }
.ap-pub-nav a { color: var(--ap-muted); text-decoration: none; font-weight: 600; font-size: 14.5px; }
.ap-pub-nav a:hover { color: var(--ap-text); }
.ap-pub-actions { margin-left: auto; display: flex; gap: 8px; }
.ap-pub-actions .ap-btn { height: 40px; padding: 0 14px; font-size: 14px; }
@media (min-width: 960px) { .ap-pub-nav { display: flex; } }
@media (max-width: 420px) { .ap-pub-actions .ap-btn.ghost { display: none; } }
.ap-pub-hero { padding: 40px 0 24px; }
.ap-pub-hero-grid { display: grid; gap: 32px; align-items: center; }
@media (min-width: 960px) { .ap-pub-hero-grid { grid-template-columns: 1.15fr .85fr; padding-top: 24px; } }
.ap-pub-kicker { display: inline-block; font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin-bottom: 8px; }
.ap-pub-hero h1 { font-size: clamp(32px, 6vw, 56px); line-height: 1.05; letter-spacing: -.02em; margin: 0 0 14px; color: var(--ap-text); }
.ap-pub-lead { font-size: 17px; color: var(--ap-muted); max-width: 560px; margin: 0 0 22px; }
.ap-pub-cta { display: flex; flex-wrap: wrap; gap: 10px; }
.ap-pub-trust { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 22px; color: var(--ap-muted); font-size: 13.5px; }
.ap-pub-trust i { color: var(--accent); }
.ap-pub-phone { justify-self: center; width: min(340px, 100%); border-radius: 40px; padding: 10px; background: var(--ap-text); box-shadow: var(--ap-shadow); }
.ap-pub-phone-screen { border-radius: 32px; background: var(--bg); padding: 18px 14px; display: flex; flex-direction: column; gap: 10px; }
.ap-pub-phone-screen .ap-card { margin: 0; }
.ap-pub-phone-top { display: flex; align-items: center; justify-content: space-between; color: var(--ap-text); font-size: 18px; }
.ap-pub-section { padding: 48px 0; }
.ap-pub-section.alt { background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.ap-pub-head { text-align: center; max-width: 680px; margin: 0 auto 26px; }
.ap-pub-head h2 { font-size: clamp(24px, 4vw, 34px); margin: 0 0 8px; color: var(--ap-text); letter-spacing: -.01em; }
.ap-pub-grid { display: grid; gap: 12px; }
@media (min-width: 700px) { .ap-pub-grid.three, .ap-pub-grid.four { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .ap-pub-grid.three { grid-template-columns: repeat(3, 1fr); } .ap-pub-grid.four { grid-template-columns: repeat(4, 1fr); } }
.ap-pub-grid > .ap-card { margin: 0; }
.ap-pub-feature { display: flex; flex-direction: column; gap: 6px; color: inherit; text-decoration: none; }
.ap-pub-feature i { font-size: 24px; color: var(--accent); }
.ap-pub-feature b { font-size: 16.5px; color: var(--ap-text); }
a.ap-pub-feature:hover { border-color: var(--accent); }
.ap-pub-step { display: flex; flex-direction: column; gap: 6px; }
.ap-pub-step-no { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 800; font-family: var(--mono); }
.ap-pub-quote { margin: 0; display: flex; flex-direction: column; justify-content: space-between; gap: 12px; }
.ap-pub-quote blockquote { margin: 0; font-size: 15px; color: var(--ap-text); }
.ap-pub-quote figcaption { display: flex; flex-direction: column; font-size: 13.5px; }
.ap-pub-faq { border-top: 1px solid var(--line); padding: 0 16px; }
.ap-pub-faq:first-child { border-top: 0; }
.ap-pub-faq summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; gap: 12px; padding: 15px 0; font-weight: 600; color: var(--ap-text); }
.ap-pub-faq summary::-webkit-details-marker { display: none; }
.ap-pub-faq[open] summary i { transform: rotate(45deg); }
.ap-pub-faq summary i { transition: transform .2s; color: var(--accent); }
.ap-pub-faq p { margin: 0 0 15px; }
.ap-pub-final { text-align: center; padding: 36px 20px; }
.ap-pub-final h2 { font-size: clamp(22px, 4vw, 30px); margin: 0 0 8px; color: var(--ap-text); }
.ap-pub-foot { border-top: 1px solid var(--line); padding: 36px 0 24px; background: var(--surface); }
.ap-pub-foot-grid { display: grid; gap: 24px; }
@media (min-width: 760px) { .ap-pub-foot-grid { grid-template-columns: 2fr 1fr 1fr; } }
.ap-pub-foot-grid > div { display: flex; flex-direction: column; gap: 8px; }
.ap-pub-foot-grid b { color: var(--ap-text); margin-bottom: 4px; }
.ap-pub-foot-grid a { color: var(--ap-muted); text-decoration: none; font-size: 14px; }
.ap-pub-foot-grid a:hover { color: var(--ap-text); }
.ap-pub-foot-logo { height: 30px; width: auto; align-self: flex-start; }
.ap-pub-copy { font-size: 13px; margin: 24px 0 0; }

/* Signal Leaderboard / provider report (partials/copier_dashboard_report and
   the provider application page) take the design's colours in the app. */
body.ap-body #copierDashboard, body.ap-body #copierUserDashboard {
    --cd-bg: var(--bg); --cd-card: var(--surface); --cd-card-2: var(--surface-2); --cd-border: var(--line);
    --cd-text: var(--ap-text); --cd-muted: var(--ap-muted); --cd-muted-2: var(--ap-muted);
    --cd-signal: var(--in); --cd-signal-dim: color-mix(in srgb, var(--in) 14%, transparent);
    --cd-loss: var(--out); --cd-loss-dim: color-mix(in srgb, var(--out) 14%, transparent);
    --cd-amber: var(--warning); --cd-amber-dim: color-mix(in srgb, var(--warning) 16%, transparent);
    --cd-primary: var(--accent); --cd-primary-dark: var(--accent); --cd-shadow: var(--ap-shadow);
    --cd-mono: var(--mono);
}
body.ap-body :is(#copierDashboard, #copierUserDashboard) :is(.range-pills .btn, .custom-range-box, .log-delete-btn, .bulk-delete-btn, .log-search, .log-pager button) { background: var(--surface); }
body.ap-body :is(#copierDashboard, #copierUserDashboard) .range-pills .btn.active { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
body.ap-body :is(#copierDashboard, #copierUserDashboard) :is(.stat-card, .report-card, .ui-card) { border-radius: var(--radius); }
body.ap-body :is(#copierDashboard, #copierUserDashboard) .table { --bs-table-bg: transparent; --bs-table-color: var(--ap-text); color: var(--ap-text); }
body.ap-body :is(#copierDashboard, #copierUserDashboard) .nav-pills .nav-link.active { background: var(--accent); color: var(--on-accent); }
body.ap-body .ap-content [style*="background:#f5f8fb"] { background: var(--surface-2) !important; }
.ap-pub-page { padding-top: 22px; padding-bottom: 40px; }
.ap-pub-page-title { font-size: clamp(26px, 4.5vw, 38px); letter-spacing: -.01em; margin: 6px 0 12px; color: var(--ap-text); }
.ap-pub-post { display: flex; flex-direction: column; overflow: hidden; color: inherit; text-decoration: none; margin: 0; }
.ap-pub-post img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; }
.ap-pub-post-icon { display: grid; place-items: center; aspect-ratio: 16 / 9; background: var(--accent-soft); color: var(--accent); font-size: 34px; }
.ap-pub-article { color: var(--ap-text); font-size: 15.5px; line-height: 1.7; overflow-wrap: anywhere; }
.ap-pub-article img { max-width: 100%; height: auto; border-radius: var(--radius-sm); }
.ap-pub-article h1, .ap-pub-article h2, .ap-pub-article h3, .ap-pub-article h4 { color: var(--ap-text); margin: 1.2em 0 .5em; }
.ap-pub-article a { color: var(--accent); }
.ap-public .ap-content { padding: 0; }
.ap-public.ap-has-tabbar { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
@media (min-width: 960px) { .ap-public.ap-has-tabbar { padding-bottom: 0; } }
.ap-pub-logos { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.ap-pub-logos .ap-card { margin: 0; padding: 12px 18px; display: grid; place-items: center; }
.ap-pub-logos img { max-height: 34px; width: auto; }
.ap-pub-rank { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; }
.ap-pub-rank.first { border-color: var(--accent); }
.ap-pub-rank b { color: var(--ap-text); font-size: 16.5px; }
.ap-pub-calc .row { --bs-gutter-y: 12px; }
.ap-pub-calc .feature-card, .ap-pub-calc .service-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; color: var(--ap-text); }
.ap-pub-calc .section-kicker { display: block; font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin-bottom: 8px; }
.ap-pub-calc h3 { font-size: 20px; color: var(--ap-text); }
.ap-pub-calc .plan-list li { border-color: var(--line) !important; }
.ap-pub-calc .profit-result { background: var(--surface-2) !important; }
.ap-pub-calc .btn-main { width: 100%; }
.ap-form .newsletter-input { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 4px 4px 4px 12px; }
.ap-form .newsletter-input input { flex: 1; min-width: 0; border: 0; background: none; outline: 0; color: var(--ap-text); height: 40px; }
.ap-form .newsletter-input button { border: 0; background: var(--accent); color: var(--on-accent); border-radius: var(--radius-sm); padding: 0 16px; height: 40px; font-weight: 700; }
.ap-form .newsletter-input button[type="submit"] { width: auto; flex: none; height: 40px; font-size: 14px; padding: 0 16px; }

/* Signal Leaderboard / provider report in the app design: the same cards,
   chips and lists as the rest of the app (their markup is shared with admin). */
body.ap-body :is(#copierDashboard, #copierUserDashboard) .stat-card { box-shadow: none; border-radius: var(--radius); padding: 14px 16px; }
body.ap-body :is(#copierDashboard, #copierUserDashboard) .stat-label { font-size: 12px; color: var(--ap-muted); }
body.ap-body :is(#copierDashboard, #copierUserDashboard) .stat-value { font-family: var(--mono); font-variant-numeric: tabular-nums; color: var(--ap-text); }
body.ap-body :is(#copierDashboard, #copierUserDashboard) :is(.nav-pills, .nav-pills-custom) { display: flex; flex-wrap: nowrap; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
body.ap-body :is(#copierDashboard, #copierUserDashboard) :is(.nav-pills, .nav-pills-custom) .nav-link { white-space: nowrap; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ap-text); font-family: inherit; font-weight: 600; font-size: 13.5px; padding: 7px 14px; }
body.ap-body :is(#copierDashboard, #copierUserDashboard) :is(.nav-pills, .nav-pills-custom) .nav-link.active { background: var(--ap-text); color: var(--bg); border-color: var(--ap-text); }
body.ap-body :is(#copierDashboard, #copierUserDashboard) :is(.report-table, .table) thead th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--ap-muted); background: var(--surface-2); border-color: var(--line); white-space: nowrap; }
body.ap-body :is(#copierDashboard, #copierUserDashboard) :is(.report-table, .table) td { border-color: var(--line); }
body.ap-body :is(#copierDashboard, #copierUserDashboard) .table-scroll { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow-x: auto; }
body.ap-body :is(#copierDashboard, #copierUserDashboard) :is(.section-title) { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ap-muted); }
body.ap-body :is(#copierDashboard, #copierUserDashboard) .pill { border-radius: 999px; font-weight: 700; font-size: 11.5px; }
body.ap-legacy .ap-content .ui-card { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: none; background: var(--surface); }
body.ap-legacy .ap-content .badge.bg-success { background: color-mix(in srgb, var(--in) 16%, transparent) !important; color: var(--in) !important; }
body.ap-legacy .ap-content .badge.bg-danger { background: color-mix(in srgb, var(--out) 16%, transparent) !important; color: var(--out) !important; }
body.ap-legacy .ap-content .badge.bg-warning { background: color-mix(in srgb, var(--warning) 18%, transparent) !important; color: var(--warning) !important; }
body.ap-legacy .ap-content .border-bottom { border-color: var(--line) !important; }

/* ---------- Dashboard standing card: animated while the account is active ---------- */
.ap-standing { position: relative; }
:root .ap-card.ap-standing.is-active {
    border: 1.5px solid transparent;
    background:
        linear-gradient(var(--surface), var(--surface)) padding-box,
        linear-gradient(120deg, var(--in), var(--accent), var(--in), var(--accent)) border-box;
    background-size: 100% 100%, 300% 300%;
    animation: ap-standing-border 6s linear infinite, ap-standing-glow 2.4s ease-in-out infinite;
}
.ap-standing.is-active .bi-award { color: var(--accent); display: inline-block; animation: ap-standing-award 2.4s ease-in-out infinite; }
.ap-standing-dot { font-size: 7px; vertical-align: middle; animation: ap-standing-dot 1.6s ease-in-out infinite; }
@keyframes ap-standing-border { 0% { background-position: 0 0, 0% 50%; } 100% { background-position: 0 0, 300% 50%; } }
@keyframes ap-standing-glow {
    0%, 100% { box-shadow: var(--ap-shadow), 0 0 0 0 color-mix(in srgb, var(--in) 0%, transparent); }
    50% { box-shadow: var(--ap-shadow), 0 0 18px 2px color-mix(in srgb, var(--in) 28%, transparent); }
}
@keyframes ap-standing-award { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.18); } }
@keyframes ap-standing-dot { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) {
    .ap-standing.is-active, .ap-standing.is-active .bi-award, .ap-standing-dot { animation: none; }
}

/* ---------- Feed (the blog for a signed-in user): posts one under another ---------- */
.ap-feed { display: flex; flex-direction: column; gap: 10px; max-width: 640px; }
.ap-feed-post { margin: 0; }
.ap-feed-link { display: block; color: inherit; text-decoration: none; padding: 14px 16px 10px; }
.ap-feed-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.ap-feed-head b { display: block; font-size: 14.5px; }
.ap-feed-head .ap-sub { font-size: 12.5px; color: var(--ap-muted); }
.ap-feed-avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--accent-soft); display: grid; place-items: center; overflow: hidden; flex-shrink: 0; }
.ap-feed-avatar img { width: 24px; height: 24px; object-fit: contain; }
.ap-feed-title { font-size: 16.5px; font-weight: 700; line-height: 1.35; margin: 0 0 4px; color: var(--ap-text); }
.ap-feed-text { font-size: 14px; line-height: 1.5; color: var(--ap-muted); margin: 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.ap-feed-image { display: block; width: 100%; max-height: 220px; object-fit: cover; border-radius: var(--radius-sm); margin-top: 10px; }
.ap-feed-actions { display: flex; border-top: 1px solid var(--line); }
.ap-feed-actions > * { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 10px; font-size: 13.5px; font-weight: 600; color: var(--ap-muted); background: none; border: 0; text-decoration: none; }
.ap-feed-actions > * + * { border-left: 1px solid var(--line); }
.ap-feed-actions > *:hover { color: var(--accent); background: var(--surface-2); }

/* ---------- YouTube video (feed and blog post) ---------- */
.ap-video { position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius-sm); overflow: hidden; background: #000; }
.ap-video iframe, .ap-video-start { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; padding: 0; background: none; cursor: pointer; }
.ap-video-start img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ap-video-play { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 62px; height: 44px; border-radius: 12px; background: rgba(255, 0, 0, .9); color: #fff; display: grid; place-items: center; font-size: 28px; box-shadow: 0 4px 14px rgba(0, 0, 0, .35); transition: transform .15s; }
.ap-video-start:hover .ap-video-play { transform: translate(-50%, -50%) scale(1.08); }
.ap-feed-video { margin: 0 16px 12px; }
.ap-pub-article .ap-video { margin-bottom: 16px; }

