/* PONSUM app (/app) and /verify. Tokens, fonts and resets come from /css/base.css; every class here is
   prefixed ap- (app) or vf- (verify) so the marketing components never collide with the app. */

:root {
  --ap-top: 56px;
  --ap-side: 272px;
  --ap-tab: 64px;
  --ap-muted: #6b645a;
  --ap-card: #fcfbf4;
  --ap-soft: #e8e6d6;
  --ap-line: #d6d3c3;
  --ap-green: #45f824;
  /* links and "in" legs on the card measure 4.77:1 (WCAG AA needs 4.5): a lighter green or a darker card fails */
  --ap-green-dark: #1a7a0e;
  --ap-red: #b3361b;
  --ap-radius: 12px;
}

/* ------------------------------------------------------------------ frame */
/* the app frame is exactly the viewport: the page itself never scrolls (phones included), only .ap-main does */
html.ap-html, html.ap-html body { height: 100%; overflow: hidden; overscroll-behavior: none; }
.ap-body { margin: 0; background: var(--bg-primary); color: var(--text-primary); font-family: var(--font-body); font-size: 15px; line-height: 1.45; overflow: hidden; -webkit-font-smoothing: antialiased; }
.ap-boot { display: flex; align-items: center; justify-content: center; height: 100vh; height: 100dvh; }
.ap-boot-inner { display: flex; flex-direction: column; align-items: center; gap: 12px; color: var(--text-secondary); padding: 24px; text-align: center; }
.ap-noscript { padding: 24px; text-align: center; }
.ap-root { display: grid; grid-template-columns: var(--ap-side) minmax(0, 1fr); grid-template-rows: var(--ap-top) minmax(0, 1fr) auto; height: 100vh; height: 100dvh; overflow: hidden; }
/* browsers without dvh get the visible height from app.js */
.ap-root.ap-root--vh { height: var(--ap-vh, 100vh); }
.ap-root.is-collapsed { grid-template-columns: 0 minmax(0, 1fr); }
.ap-root.is-collapsed .ap-side { visibility: hidden; overflow: hidden; border: 0; }
.ap-sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.ap-ico { flex: none; display: block; }

/* top bar */
.ap-top { grid-column: 1 / -1; grid-row: 1; display: flex; align-items: center; gap: 8px; min-width: 0; padding: 0 16px 0 12px; background: var(--bg-secondary); border-bottom: 1px solid var(--border-primary); position: relative; z-index: 20; }
.ap-brand { display: inline-flex; align-items: center; gap: 10px; min-width: 0; min-height: 40px; color: var(--text-primary); text-decoration: none; }
.ap-brand-mark { display: inline-flex; width: 22px; height: 22px; flex: none; }
.ap-brand-mark svg, .ap-brand-mark-svg { width: 22px; height: 22px; display: block; }
.ap-brand-word { display: inline-flex; height: 18px; min-width: 0; }
.ap-brand-word svg, .ap-brand-word-svg { height: 18px; width: auto; display: block; }
.ap-brand-text { font-weight: 700; letter-spacing: .02em; font-size: 18px; }
.ap-top-right { margin-left: auto; display: flex; align-items: center; gap: 2px; min-width: 0; }
.ap-top-help { width: auto; padding: 0 6px; gap: 2px; }
.ap-dot { width: 8px; height: 8px; border-radius: 50%; background: #b2aea2; margin: 0 8px 0 4px; flex: none; }
.ap-dot[data-state="ok"] { background: #599643; }
.ap-dot[data-state="error"] { background: #f35b3c; }
.ap-dot[data-state="syncing"] { background: #d99a00; animation: ap-pulse 1.2s ease-in-out infinite; }
@keyframes ap-pulse { 50% { opacity: .35; } }
.ap-wallet-slot { display: flex; min-width: 0; }
.ap-wallet-chip { display: inline-flex; align-items: center; gap: 8px; min-width: 0; height: 40px; padding: 0 12px 0 6px; border-radius: 20px; border: 1px solid var(--border-primary); background: var(--bg-primary); font-size: 14px; cursor: pointer; }
.ap-wallet-chip:hover { border-color: var(--border-secondary); }
.ap-wallet-chip.is-wrong { border-color: #d99a00; background: #fbf1d6; }
.ap-wallet-chip-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ap-avatar { width: 26px; height: 26px; border-radius: 50%; flex: none; box-shadow: inset 0 0 0 1px rgba(32, 29, 25, .12); }

/* sidebar */
.ap-side { grid-column: 1; grid-row: 2 / -1; position: relative; display: flex; flex-direction: column; min-height: 0; overflow-y: auto; overscroll-behavior: contain; background: var(--bg-secondary); border-right: 1px solid var(--border-primary); }
.ap-side-head { display: none; }
.ap-ws { display: flex; align-items: stretch; margin: 16px 12px 10px; border: 1px solid #cfccbb; border-radius: 6px; background: var(--ap-soft); min-width: 0; }
.ap-ws-main { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; padding: 10px 4px 10px 12px; color: var(--text-primary); text-decoration: none; border-radius: 6px 0 0 6px; }
.ap-ws-main:hover { background: rgba(32, 29, 25, .04); }
.ap-ws-ico { display: inline-flex; flex: none; }
.ap-ws-text { display: flex; flex-direction: column; min-width: 0; }
.ap-ws-name, .ap-ws-value { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ap-ws-name { font-size: 16px; }
.ap-ws-value { font-size: 14px; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.ap-ws-switch { flex: none; width: 44px; display: inline-flex; align-items: center; justify-content: center; border-radius: 0 6px 6px 0; cursor: pointer; }
.ap-ws-switch:hover { background: rgba(32, 29, 25, .06); }
.ap-nav { display: flex; flex-direction: column; padding: 4px 0; }
.ap-nav-item { display: flex; align-items: center; gap: 14px; min-height: 48px; margin: 1px 12px; padding: 0 12px; border-radius: 6px; border: 1px solid transparent; color: var(--text-primary); font-size: 16px; text-decoration: none; min-width: 0; }
.ap-nav-item:hover { background: rgba(32, 29, 25, .05); }
.ap-nav-item.is-active { background: var(--ap-soft); border-color: #cfccbb; }
.ap-nav-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ap-nav-sep { height: 1px; background: var(--border-primary); margin: 10px 12px; }
.ap-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 24px; height: 24px; padding: 0 7px; border-radius: 12px; background: #dcf7d3; color: #1a6b0c; font-size: 13px; line-height: 1; flex: none; }
.ap-badge--inline { min-width: 20px; height: 20px; font-size: 12px; padding: 0 6px; }
.ap-side-foot { margin-top: auto; padding: 16px 24px 20px; }
.ap-side-plan { display: inline-flex; align-items: center; gap: 8px; color: var(--text-secondary); font-size: 14px; text-decoration: none; min-height: 40px; }
.ap-side-plan:hover { color: var(--text-primary); }
.ap-collapse { display: none; }
.ap-side-scrim { display: none; }
/* position: relative keeps absolutely positioned children (screen reader labels) inside the scroll box, so they
   never stretch the document past the viewport */
.ap-main { grid-column: 2; grid-row: 2; position: relative; min-width: 0; min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; outline: none; scroll-padding: 12px 0; }
.ap-tabbar { display: none; }

/* banners */
.ap-banner { display: flex; align-items: center; gap: 10px; padding: 10px 48px; font-size: 14px; border-bottom: 1px solid var(--border-primary); flex-wrap: wrap; }
.ap-banner > span { flex: 1 1 260px; min-width: 0; }
.ap-banner--preview { background: #fbf3dc; }
.ap-banner--client { background: #e9f8e3; }

/* ------------------------------------------------------------ typography */
.ap-page { max-width: 1180px; margin: 0 auto; padding: 44px 48px 72px; min-width: 0; }
.ap-page--wide { max-width: 1320px; }
.ap-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 28px; }
.ap-head-text { min-width: 0; flex: 1 1 320px; }
.ap-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ap-h1 { font-family: var(--font-heading); font-weight: 400; text-transform: uppercase; font-size: 2.5rem; line-height: 1.05; letter-spacing: -.05rem; margin: 0; overflow-wrap: anywhere; }
.ap-head-sub { margin: 10px 0 0; max-width: 64ch; color: var(--text-secondary); font-size: 15px; }
.ap-display { font-family: var(--font-heading); font-weight: 400; text-transform: uppercase; font-size: 2.5rem; line-height: 1.02; letter-spacing: -.05rem; margin: 6px 0 16px; overflow-wrap: anywhere; }
.ap-h2 { display: flex; align-items: center; gap: 8px; margin: 0; font-family: var(--font-body); font-weight: 400; font-size: 1.375rem; line-height: 1.25; letter-spacing: -.01em; min-width: 0; }
.ap-h3 { margin: 0 0 8px; font-size: 1.0625rem; font-weight: 500; }
.ap-p { margin: 0 0 8px; overflow-wrap: anywhere; }
.ap-p:last-child { margin-bottom: 0; }
.ap-label { margin: 0 0 8px; font-family: var(--font-label); text-transform: uppercase; letter-spacing: .06em; font-size: 12px; color: var(--text-secondary); }
.ap-muted { color: var(--ap-muted); }
.ap-mono { font-family: var(--font-label); font-size: 13px; letter-spacing: 0; }
.ap-break { overflow-wrap: anywhere; word-break: break-all; }
.ap-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ap-up { color: var(--ap-green-dark); }
.ap-down { color: var(--ap-red); }
.ap-link { color: var(--ap-green-dark); text-decoration: underline; text-underline-offset: 3px; display: inline-flex; align-items: center; gap: 4px; }
.ap-link:hover { color: #12620a; }
.ap-count { display: inline-flex; align-items: center; justify-content: center; min-width: 24px; height: 24px; padding: 0 7px; border-radius: 12px; background: var(--ap-soft); font-size: 13px; line-height: 1; }
.ap-note { font-size: 14px; color: var(--ap-muted); margin: 12px 0 0; }
.ap-pad { padding: 16px 24px; }
.ap-pad-x { padding-left: 24px; padding-right: 24px; }
.ap-stack { display: flex; flex-direction: column; gap: 12px; }
.ap-row-wrap { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ap-row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ap-show-phone { display: none; }

/* ---------------------------------------------------------------- controls */
.ap-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 8px 16px; border-radius: 8px; border: 1px solid transparent; font-family: var(--font-body); font-size: 15px; font-weight: 500; line-height: 1.2; text-align: center; color: var(--text-primary); text-decoration: none; cursor: pointer; transition: background-color .15s, border-color .15s; max-width: 100%; flex-shrink: 0; }
.ap-btn--primary { background: var(--ap-green); border-color: #1f9a0c; box-shadow: inset 0 1px 0 #b9ffab; }
.ap-btn--primary:hover { background: #6dff52; }
.ap-btn--secondary { background: var(--bg-secondary); border-color: var(--ap-line); }
.ap-btn--secondary:hover { background: var(--ap-soft); }
.ap-btn--ghost { background: transparent; }
.ap-btn--ghost:hover { background: rgba(32, 29, 25, .06); }
.ap-btn--danger { background: transparent; border-color: #e7b3a5; color: #9c2f16; }
.ap-btn--danger:hover { background: #fbe3dc; }
.ap-btn--sm { min-height: 36px; padding: 6px 12px; font-size: 14px; gap: 6px; }
.ap-btn--block { width: 100%; }
.ap-btn:disabled, .ap-btn[aria-disabled="true"] { background: var(--ap-soft); border-color: var(--border-primary); color: var(--ap-muted); box-shadow: none; cursor: not-allowed; }
.ap-file { position: relative; overflow: hidden; }
.ap-file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.ap-icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 8px; border: 0; background: transparent; color: var(--text-primary); cursor: pointer; flex: none; }
.ap-icon-btn:hover { background: rgba(32, 29, 25, .06); }
.ap-icon-btn:disabled { color: var(--ap-muted); cursor: not-allowed; background: transparent; }
.ap-icon-btn--xs { width: 28px; height: 28px; border-radius: 6px; vertical-align: middle; }
.ap-info { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; margin-left: 2px; border-radius: 50%; color: var(--ap-muted); cursor: pointer; vertical-align: middle; flex: none; }
.ap-info:hover { color: var(--text-primary); background: rgba(32, 29, 25, .06); }
.ap-tag { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 8px; border-radius: 4px; font-size: 13px; line-height: 1; white-space: nowrap; background: rgba(32, 29, 25, .07); color: var(--text-secondary); flex: none; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.ap-tag--green { background: #dcf7d3; color: #1a6b0c; }
.ap-tag--red { background: #fbe3dc; color: #9c2f16; }
.ap-tag--amber { background: #f7ecd0; color: #6f4c00; }
.ap-tag--blue { background: #e3ebf5; color: #264a73; }
.ap-tag--neutral { background: rgba(32, 29, 25, .07); color: var(--text-secondary); }
.ap-callout { display: flex; align-items: flex-start; gap: 10px; margin: 16px 0; padding: 12px 14px; border-radius: 10px; background: var(--bg-secondary); border: 1px solid var(--border-primary); font-size: 14px; }
.ap-callout > svg { margin-top: 2px; }
.ap-callout > span { min-width: 0; flex: 1; }
.ap-callout--amber { background: #fbf3dc; border-color: #eedba6; }
.ap-callout--green { background: #e9f8e3; border-color: #bfe9b0; }

/* forms */
.ap-form { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.ap-field { display: flex; flex-direction: column; min-width: 0; }
.ap-field--grow { flex: 1 1 220px; }
.ap-field-label { display: block; margin: 0 0 6px; font-size: 14px; color: var(--text-secondary); }
.ap-input, .ap-select { display: block; width: 100%; min-width: 0; height: 42px; padding: 0 12px; border: 1px solid var(--ap-line); border-radius: 6px; background: var(--bg-secondary); color: var(--text-primary); font-family: var(--font-body); font-size: 15px; }
.ap-input::placeholder { color: var(--ap-muted); }
.ap-input:focus, .ap-select:focus { outline: none; border-color: var(--ap-green-dark); box-shadow: 0 0 0 3px rgba(69, 248, 36, .3); }
.ap-input:disabled, .ap-select:disabled { opacity: .7; cursor: not-allowed; }
.ap-textarea { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; line-height: 1.4; }
.ap-select { appearance: none; -webkit-appearance: none; padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23201d19' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; text-overflow: ellipsis; }
.ap-select--btn { display: flex; align-items: center; gap: 8px; text-align: left; cursor: pointer; }
.ap-select--btn span { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ap-checkline { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; font-size: 15px; cursor: pointer; min-width: 0; }
.ap-checkline input, .ap-switchline input { width: 18px; height: 18px; accent-color: var(--ap-green-dark); flex: none; margin: 0; }
.ap-switchline { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; }
.ap-switchline input { margin-top: 3px; }
.ap-switchline > span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ap-switchline b { font-weight: 500; }
.ap-fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.ap-fieldset legend { padding: 0; }
.ap-form-error { margin: 8px 0 0; color: var(--ap-red); font-size: 14px; overflow-wrap: anywhere; }
.ap-inline-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; min-width: 0; }
.ap-inline-form > .ap-input { flex: 1 1 200px; }
.ap-grid-2, .ap-grid-3 { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ap-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ap-search { position: relative; display: flex; align-items: center; flex: 1 1 260px; min-width: 0; }
.ap-search > svg { position: absolute; left: 12px; color: var(--ap-muted); pointer-events: none; }
.ap-search-input { padding-left: 36px; }
.ap-search--s { flex: 0 1 280px; }

/* ------------------------------------------------------------------ cards */
.ap-card { background: var(--ap-card); border: 1px solid var(--border-primary); border-radius: var(--ap-radius); min-width: 0; }
.ap-section { margin-top: 20px; padding: 20px 0 8px; }
.ap-section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 0 24px 16px; min-width: 0; }
.ap-cards { display: grid; gap: 16px; margin-top: 20px; }
.ap-cards--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ap-cards--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.ap-kpi { padding: 20px; }
.ap-kpi-label { margin: 0 0 6px; font-size: 14px; color: var(--text-secondary); }
.ap-kpi-value { margin: 0; font-size: 1.75rem; line-height: 1.15; letter-spacing: -.02em; overflow-wrap: anywhere; }
.ap-kpi-value--s { font-size: 1.25rem; }
.ap-kpi-sub { margin: 6px 0 0; font-size: 13px; color: var(--ap-muted); }
.ap-kpi--save { box-shadow: inset 0 3px 0 var(--ap-green); }
.ap-empty { text-align: center; padding: 40px 24px; }
.ap-empty-ico { display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px; border-radius: 50%; background: var(--bg-secondary); }
.ap-empty .ap-h2 { justify-content: center; margin: 12px 0 6px; }
.ap-empty .ap-p { max-width: 52ch; margin-left: auto; margin-right: auto; }
.ap-empty-actions { margin-top: 16px; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

/* tables */
.ap-table-wrap { overflow-x: auto; min-width: 0; }
.ap-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.ap-table th { text-align: left; font-weight: 400; font-size: 14px; color: var(--text-secondary); padding: 10px 16px; border-top: 1px solid var(--border-primary); border-bottom: 1px solid var(--border-primary); white-space: nowrap; }
.ap-table th.ap-num { text-align: right; }
.ap-table td { padding: 14px 16px; border-bottom: 1px solid var(--border-primary); vertical-align: middle; }
.ap-table tr:last-child td { border-bottom: 0; }
.ap-table th:first-child, .ap-table td:first-child { padding-left: 24px; }
.ap-table th:last-child, .ap-table td:last-child { padding-right: 24px; }
.ap-table tr.is-current td { background: #f3f8ec; }
.ap-tags-cell { white-space: nowrap; text-align: right; }
.ap-tags-cell > * + * { margin-left: 6px; }
.ap-cell-actions { text-align: right; }
.ap-asset { display: flex; align-items: center; gap: 12px; min-width: 0; }
.ap-asset-text { display: flex; flex-direction: column; min-width: 0; }
.ap-asset-name { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ap-asset-sub { font-size: 13px; color: var(--ap-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.ap-token { display: inline-flex; align-items: center; justify-content: center; flex: none; border-radius: 50%; object-fit: cover; }
.ap-token--glyph { font-family: var(--font-label); font-size: 10px; letter-spacing: 0; color: var(--text-primary); box-shadow: inset 0 0 0 1px rgba(32, 29, 25, .1); }
.ap-token--glyph.is-stock { border-radius: 8px; font-size: 9px; }

/* rows */
.ap-rows { list-style: none; margin: 0; padding: 0 24px; }
.ap-pad-x .ap-rows { padding: 0; }
.ap-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 0; border-top: 1px solid var(--border-primary); min-width: 0; }
.ap-row > .ap-asset { flex: 1 1 200px; }
.ap-row-meta { display: flex; flex-direction: column; gap: 2px; flex: 1 1 200px; min-width: 0; font-size: 14px; overflow-wrap: anywhere; }
.ap-row-tags { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ap-anchor-id { flex: 0 1 auto; }

/* -------------------------------------------------------------- overlays */
html.ap-locked, html.ap-drawer-open { overflow: hidden; }
.ap-layer { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 24px; }
.ap-scrim { position: absolute; inset: 0; background: rgba(32, 29, 25, .42); opacity: 0; transition: opacity .18s; }
.ap-layer.is-open .ap-scrim { opacity: 1; }
.ap-sheet { position: relative; display: flex; flex-direction: column; width: 100%; max-width: 560px; max-height: calc(100vh - 48px); max-height: calc(100dvh - 48px); background: var(--bg-primary); border: 1px solid var(--border-primary); border-radius: 16px; box-shadow: 0 24px 64px rgba(32, 29, 25, .22); opacity: 0; transform: translateY(8px); transition: opacity .18s, transform .18s; min-width: 0; }
.ap-layer.is-open .ap-sheet { opacity: 1; transform: none; }
.ap-sheet--sm { max-width: 440px; }
.ap-sheet--lg { max-width: 980px; }
.ap-sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 12px 8px 20px; min-width: 0; }
.ap-sheet-title { margin: 0; font-family: var(--font-heading); font-weight: 400; font-size: 1.5rem; line-height: 1.15; letter-spacing: -.02em; min-width: 0; overflow-wrap: anywhere; }
.ap-sheet-body { position: relative; flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 8px 20px 20px; overscroll-behavior: contain; }
.ap-sheet-foot { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; padding: 12px 20px 16px; border-top: 1px solid var(--border-primary); }
.ap-layer--drawer { justify-content: flex-end; align-items: stretch; padding: 0; }
.ap-sheet--drawer { max-width: 480px; height: 100%; max-height: none; border-radius: 0; border-width: 0 0 0 1px; transform: translateX(24px); }
.ap-preview .ap-sheet-body { padding: 0 20px 20px; }
.ap-preview-frame { display: block; width: 100%; height: 70vh; border: 1px solid var(--border-primary); border-radius: 8px; background: #fff; }
.ap-print-frame { position: fixed; right: 0; bottom: 0; width: 0; height: 0; border: 0; opacity: 0; pointer-events: none; }
.ap-pop { position: fixed; z-index: 110; background: var(--bg-primary); border: 1px solid var(--border-primary); border-radius: 12px; box-shadow: 0 12px 32px rgba(32, 29, 25, .16); padding: 6px; max-height: calc(100vh - 24px); overflow: auto; min-width: 0; }
.ap-menu { display: flex; flex-direction: column; }
.ap-menu-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 42px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; text-align: left; cursor: pointer; font-size: 15px; color: var(--text-primary); min-width: 0; }
.ap-menu-item:hover:not(:disabled), .ap-menu-item:focus-visible { background: rgba(32, 29, 25, .06); }
.ap-menu-item:disabled { color: var(--ap-muted); cursor: not-allowed; }
.ap-menu-item.is-danger { color: #9c2f16; }
.ap-menu-item.is-active { font-weight: 500; }
.ap-menu-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ap-menu-hint { flex: none; font-size: 13px; color: var(--ap-muted); }
.ap-menu-sep { height: 1px; background: var(--border-primary); margin: 4px 6px; }
.ap-pop-text { margin: 8px 10px; font-size: 14px; }
.ap-pop-pad { padding: 8px 10px; }
.ap-pop-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.ap-sync-rows { list-style: none; margin: 0; padding: 0; }
.ap-sync-row { display: flex; flex-direction: column; padding: 8px 0; border-top: 1px solid var(--border-primary); min-width: 0; }
.ap-sync-row-name, .ap-sync-row-meta { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ap-sync-row-meta { font-size: 13px; color: var(--ap-muted); }
/* Toasts get their own row: under the page's scroll box in the app frame (app.js) and under the body of an open
   sheet (ui.js). The scroll box shrinks while one shows, so a toast never covers text or a control. */
.ap-toasts { grid-column: 2; grid-row: 3; position: relative; z-index: 20; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; padding: 8px 16px; background: var(--bg-secondary); border-top: 1px solid var(--border-primary); }
.ap-sheet-toasts { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; padding: 8px 20px; border-top: 1px solid var(--border-primary); }
.ap-toasts:empty, .ap-sheet-toasts:empty { display: none; }
/* only before the app frame exists */
.ap-toasts--float { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 130; width: max-content; max-width: calc(100vw - 32px); padding: 0; background: none; border: 0; pointer-events: none; }
.ap-toast { display: flex; align-items: center; gap: 10px; max-width: 100%; padding: 10px 14px; border-radius: 10px; background: #201d19; color: #f9f8ee; font-size: 14px; box-shadow: 0 6px 18px rgba(32, 29, 25, .18); transition: opacity .25s, transform .25s; min-width: 0; }
.ap-toast span { min-width: 0; overflow-wrap: anywhere; }
.ap-toast--success svg { color: var(--ap-green); }
.ap-toast--error svg { color: #ff9b85; }
.ap-toast.is-out { opacity: 0; transform: translateY(6px); }
.ap-kbd-list { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ap-kbd-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ap-kbd-keys { display: inline-flex; gap: 4px; flex: none; }
.ap-kbd { display: inline-flex; align-items: center; justify-content: center; min-width: 26px; height: 26px; padding: 0 6px; border: 1px solid #cfccbb; border-bottom-width: 2px; border-radius: 6px; background: var(--ap-card); font-family: var(--font-label); font-size: 12px; }
.ap-wallet-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.ap-wallet-opt { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 0 14px; border: 1px solid var(--border-primary); border-radius: 10px; background: var(--ap-card); cursor: pointer; text-align: left; font-size: 15px; }
.ap-wallet-opt:hover { border-color: var(--border-secondary); }
.ap-wallet-opt > span:not(.ap-wallet-opt-ico) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-wallet-opt img { border-radius: 6px; flex: none; }
.ap-wallet-opt-ico { display: inline-flex; width: 28px; justify-content: center; }
.ap-country-list { margin-top: 12px; }
.ap-country-group { margin-top: 16px; }
.ap-country-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.ap-country-opt { min-height: 40px; padding: 0 12px; border: 1px solid var(--border-primary); border-radius: 8px; background: var(--ap-card); text-align: left; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ap-country-opt.is-active { border-color: var(--text-primary); }

/* ------------------------------------------------------------- portfolio */
.ap-pf { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: stretch; }
.ap-pf-chart { padding: 24px 24px 20px; display: flex; flex-direction: column; overflow: hidden; }
.ap-pf-top { min-width: 0; }
.ap-pf-label { margin: 0; font-size: 15px; color: var(--text-secondary); }
.ap-pf-balance { margin: 2px 0 4px; font-size: 2.25rem; line-height: 1.15; letter-spacing: -.02em; overflow-wrap: anywhere; }
.ap-pf-change { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0; font-size: 16px; }
.ap-chart { position: relative; height: 240px; margin: 16px -24px 0; min-width: 0; }
.ap-chart-svg { display: block; }
.ap-chart-loading { display: flex; align-items: center; justify-content: center; height: 100%; color: var(--ap-muted); font-size: 14px; }
.ap-chart-tip { position: absolute; top: 0; display: flex; flex-direction: column; gap: 2px; padding: 6px 10px; border-radius: 8px; background: #201d19; color: #f9f8ee; font-size: 12px; white-space: nowrap; pointer-events: none; font-variant-numeric: tabular-nums; }
.ap-chart-tip span { display: inline-flex; align-items: center; gap: 6px; }
.ap-chart-tip-date { color: #d8d5c6; }
.ap-sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; flex: none; }
.ap-sw--value { background: var(--ap-green); box-shadow: inset 0 0 0 1px #2fa61a; }
.ap-sw--net { background: #8a8275; }
.ap-chart-axis { display: flex; justify-content: space-between; gap: 12px; padding: 8px 8px 0; font-size: 14px; color: var(--text-secondary); }
.ap-chart-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; margin-top: 16px; }
.ap-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.ap-pill { min-width: 52px; height: 36px; padding: 0 14px; border: 1px solid transparent; border-radius: 4px; background: rgba(32, 29, 25, .05); font-size: 15px; cursor: pointer; }
.ap-pill:hover { background: rgba(32, 29, 25, .09); }
.ap-pill[aria-pressed="true"] { background: var(--border-primary); border-color: #8a8275; }
.ap-legend { display: flex; align-items: center; gap: 6px 14px; flex-wrap: wrap; font-size: 14px; }
.ap-legend-item { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.ap-pf-stats { display: flex; flex-direction: column; padding: 8px 24px; }
.ap-stat { padding: 16px 0; border-bottom: 1px solid var(--border-primary); min-width: 0; }
.ap-stat:last-child { border-bottom: 0; }
.ap-stat-label { display: flex; align-items: center; margin: 0 0 4px; font-size: 15px; color: var(--text-secondary); }
.ap-stat-value { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0; font-size: 1.25rem; overflow-wrap: anywhere; }
.ap-pf + .ap-section, [data-pf="progress"] + .ap-pf { margin-top: 20px; }

/* onboarding + sync progress */
.ap-onboard { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 460px); gap: 40px; align-items: start; }
.ap-onboard-intro .ap-p { font-size: 1.0625rem; color: var(--text-secondary); max-width: 58ch; }
.ap-onboard-points { list-style: none; padding: 0; margin: 20px 0 0; display: flex; flex-direction: column; gap: 10px; }
.ap-onboard-points li { display: flex; align-items: center; gap: 10px; }
.ap-onboard-points svg { color: var(--ap-green-dark); }
.ap-onboard-steps { padding: 4px 24px; }
.ap-step { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 14px; padding: 20px 0; border-bottom: 1px solid var(--border-primary); }
.ap-step:last-child { border-bottom: 0; }
.ap-step-n { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--border-secondary); font-size: 14px; flex: none; }
.ap-step-body { min-width: 0; }
.ap-step-body .ap-inline-form .ap-input { flex: 1 1 180px; }
.ap-onboard-or { display: flex; align-items: center; gap: 10px; margin: 12px 0; color: var(--ap-muted); font-size: 13px; }
.ap-onboard-or::before, .ap-onboard-or::after { content: ''; flex: 1; height: 1px; background: var(--border-primary); }
.ap-chips { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.ap-chip { display: inline-flex; align-items: center; gap: 2px; max-width: 100%; min-height: 34px; padding: 0 2px 0 12px; border-radius: 17px; background: var(--ap-soft); font-size: 14px; }
.ap-chip-text { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ap-chip-x { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%; border: 0; background: transparent; cursor: pointer; flex: none; }
.ap-chip-x:hover { background: rgba(32, 29, 25, .08); }
.ap-country-now { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.ap-syncp { margin-top: 16px; padding: 12px 16px; border: 1px solid var(--border-primary); border-radius: 10px; background: var(--ap-card); min-width: 0; }
.ap-syncp-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ap-syncp-head .ap-label { margin: 0; }
.ap-syncp-list { list-style: none; margin: 0; padding: 0; }
.ap-syncp-row { margin-top: 12px; min-width: 0; }
.ap-syncp-top { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }
.ap-syncp-name { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ap-syncp-count { flex: none; color: var(--ap-muted); font-variant-numeric: tabular-nums; }
.ap-bar { height: 6px; margin: 6px 0; border-radius: 3px; background: var(--ap-soft); overflow: hidden; }
.ap-bar span { display: block; height: 100%; background: var(--ap-green); border-radius: 3px; transition: width .2s; }
.ap-syncp-row[data-phase="error"] .ap-bar span { background: #f35b3c; }
.ap-syncp-row[data-phase="cancelled"] .ap-bar span { background: #b2aea2; }
.ap-phases { list-style: none; padding: 0; margin: 6px 0; display: flex; flex-wrap: wrap; gap: 4px; }
.ap-phases li { padding: 2px 8px; border-radius: 10px; background: rgba(32, 29, 25, .05); color: var(--ap-muted); font-size: 12px; }
.ap-phases li.is-done { background: #dcf7d3; color: #1a6b0c; }
.ap-phases li.is-now { background: #201d19; color: #f9f8ee; }
.ap-syncp-msg { margin: 2px 0 0; font-size: 13px; color: var(--ap-muted); overflow-wrap: anywhere; }

/* accounts */
.ap-add { padding: 20px 24px; }
.ap-add .ap-h2 { margin-bottom: 6px; }
.ap-add-form { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 12px; margin-top: 14px; }
.ap-add-actions { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; }
.ap-wallets { list-style: none; margin: 0; padding: 0; }
.ap-wallet { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 2fr) auto; gap: 16px; align-items: center; padding: 16px 24px; border-top: 1px solid var(--border-primary); }
.ap-wallet-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.ap-wallet-ico { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 50%; background: var(--bg-secondary); flex: none; }
.ap-wallet-text { min-width: 0; }
.ap-wallet-name { margin: 0; display: flex; align-items: center; gap: 6px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ap-wallet-addr { margin: 0; display: flex; align-items: center; gap: 4px; color: var(--ap-muted); }
.ap-wallet-meta { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 0; }
.ap-wallet-meta dt { font-size: 13px; color: var(--ap-muted); }
.ap-wallet-meta dd { margin: 2px 0 0; font-size: 14px; min-width: 0; overflow-wrap: anywhere; }
.ap-wallet-actions { display: flex; align-items: center; gap: 4px; }

/* transactions */
.ap-tx { overflow: hidden; }
.ap-tx-toolbar { display: flex; align-items: center; gap: 8px; padding: 16px 24px; flex-wrap: wrap; }
.ap-tx-panel { border-top: 1px solid var(--border-primary); }
.ap-filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; padding: 16px 24px; min-width: 0; }
.ap-sheet .ap-filters { padding: 0; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.ap-filters-checks { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 0 20px; }
.ap-filters-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; }
.ap-tx-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; padding: 6px 24px; border-top: 1px solid var(--border-primary); min-height: 52px; }
.ap-tx-bulk { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ap-tx-bulk-n { font-size: 14px; margin-right: 4px; }
.ap-tx-head, .ap-tx-row { display: grid; grid-template-columns: 36px 170px minmax(0, 1fr) 120px 170px 40px; gap: 12px; align-items: center; padding: 0 12px 0 20px; }
.ap-tx-head { height: 36px; font-size: 13px; color: var(--ap-muted); background: #f6f5ea; border-top: 1px solid var(--border-primary); border-bottom: 1px solid var(--border-primary); }
.ap-vlist { position: relative; min-width: 0; overflow: hidden; }
.ap-tx-group, .ap-tx-row { position: absolute; left: 0; right: 0; top: 0; box-sizing: border-box; }
.ap-tx-group { display: flex; align-items: center; gap: 16px; padding: 0 20px; background: var(--bg-secondary); border-bottom: 1px solid var(--border-primary); font-size: 13px; color: var(--text-secondary); min-width: 0; }
.ap-tx-date { flex: none; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ap-tx-hash { flex: none; display: inline-flex; align-items: center; gap: 4px; font-family: var(--font-label); font-size: 12px; color: var(--ap-green-dark); white-space: nowrap; }
.ap-tx-wallet { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ap-tx-fee { flex: none; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ap-tx-row { border-bottom: 1px solid var(--border-primary); background: var(--ap-card); }
.ap-tx-row:hover { background: #f6f5ea; }
.ap-tx-row.is-selected { background: #eef8e8; }
.ap-tx-row.is-focus { box-shadow: inset 3px 0 0 var(--text-primary); }
.ap-tx-row.is-ignored .ap-tx-legs, .ap-tx-row.is-ignored .ap-tx-value { opacity: .55; }
.ap-tx-check { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 40px; cursor: pointer; }
.ap-tx-check input, .ap-tx-bar input { width: 18px; height: 18px; accent-color: var(--ap-green-dark); }
.ap-tx-type { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ap-tx-proto { min-width: 0; font-size: 12px; color: var(--ap-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ap-tx-legs { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.ap-leg { white-space: nowrap; }
.ap-leg + .ap-leg { margin-left: 6px; }
.ap-leg--in { color: var(--ap-green-dark); }
.ap-leg-arrow { display: inline-flex; vertical-align: middle; margin: 0 6px; color: var(--ap-muted); }
.ap-tx-value { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.ap-tx-flags { display: flex; align-items: center; gap: 4px; min-width: 0; overflow: hidden; }
.ap-tx-time { margin-left: auto; font-size: 12px; color: var(--ap-muted); white-space: nowrap; }
.ap-tx-edit { justify-self: end; }
.ap-edit-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ap-dl { display: grid; gap: 10px; margin: 4px 0; }
.ap-dl > div { display: flex; justify-content: space-between; gap: 12px; min-width: 0; }
.ap-dl dt { color: var(--ap-muted); font-size: 14px; flex: none; }
.ap-dl dd { margin: 0; text-align: right; min-width: 0; overflow-wrap: anywhere; }
.ap-dl--grid { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px 20px; }
.ap-dl--grid > div { flex-direction: column; justify-content: flex-start; gap: 2px; }
.ap-dl--grid dd { text-align: left; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ap-price-row { display: grid; grid-template-columns: minmax(0, 1fr) 160px; gap: 12px; align-items: center; padding: 8px 0; border-top: 1px solid var(--border-primary); }
.ap-price-leg { display: flex; flex-direction: column; min-width: 0; font-size: 14px; }
.ap-price-leg .ap-leg { overflow: hidden; text-overflow: ellipsis; }

/* review */
.ap-chipbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 4px; }
.ap-filter-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 6px 0 14px; border-radius: 20px; border: 1px solid #cfccbb; background: transparent; font-size: 14px; cursor: pointer; max-width: 100%; }
.ap-filter-chip[aria-pressed="true"] { background: #201d19; border-color: #201d19; color: #f9f8ee; }
.ap-filter-chip[aria-pressed="true"] .ap-count { background: #454039; color: #f9f8ee; }
.ap-rv-list { list-style: none; margin: 0; padding: 0; }
.ap-rv-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px 20px; align-items: start; padding: 16px 24px; border-top: 1px solid var(--border-primary); }
.ap-rv-main { min-width: 0; }
.ap-rv-msg { margin: 0 0 4px; font-weight: 500; overflow-wrap: anywhere; }
.ap-rv-detail { margin: 0 0 8px; font-size: 14px; color: var(--text-secondary); overflow-wrap: anywhere; }
.ap-rv-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 0; font-size: 13px; color: var(--ap-muted); }
.ap-rv-event { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; font-size: 14px; min-width: 0; }
.ap-rv-legs { min-width: 0; overflow-wrap: anywhere; }
.ap-rv-legs .ap-leg { white-space: normal; }
.ap-rv-fixes { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; max-width: 360px; }
.ap-paste-results { list-style: none; padding: 0; margin: 0; font-size: 14px; display: flex; flex-direction: column; gap: 4px; overflow-wrap: anywhere; }
.ap-leg-edit { border-top: 1px solid var(--border-primary); padding-top: 10px; }

/* reports */
.ap-controls { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; padding: 20px 24px; }
.ap-gate { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 24px 12px; padding: 10px 14px; border-radius: 8px; background: var(--bg-secondary); border: 1px solid var(--border-primary); font-size: 14px; }
.ap-gate > span { flex: 1 1 220px; min-width: 0; }
.ap-gate.is-open { background: #e9f8e3; border-color: #bfe9b0; }
.ap-reports { list-style: none; margin: 0; padding: 0; }
.ap-report { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px 24px; border-top: 1px solid var(--border-primary); }
.ap-report-ico { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 8px; background: var(--bg-secondary); }
.ap-report-text { min-width: 0; }
.ap-report-title { margin: 0; font-weight: 500; }
.ap-report-desc { margin: 2px 0 0; font-size: 14px; color: var(--text-secondary); }
.ap-report-actions { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.ap-fmt { font-family: var(--font-label); font-size: 12px; letter-spacing: .04em; }
.ap-anchor-actions { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin: 16px 0 8px; }
.ap-anchor-actions .ap-field { flex: 1 1 240px; }
.ap-anchor-why { flex: 1 1 100%; margin: 0; font-size: 14px; }
.ap-anchor-past { margin: 16px 0 8px; }

/* plans */
.ap-plan-status { display: flex; flex-direction: column; gap: 6px; padding-bottom: 12px; }
.ap-tiers { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-top: 20px; }
.ap-tier { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 20px; }
.ap-tier.is-rec { border-color: #8fd97c; }
.ap-tier.is-picked { outline: 2px solid var(--text-primary); outline-offset: -2px; }
.ap-tier-rec { align-self: flex-start; }
.ap-tier-name { margin: 4px 0 0; font-family: var(--font-heading); font-weight: 400; text-transform: uppercase; font-size: 1.625rem; letter-spacing: -.03em; }
.ap-tier-price { margin: 0; font-size: 1.375rem; }
.ap-tier-list { list-style: none; padding: 0; margin: 8px 0 14px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.ap-tier-list li { display: flex; align-items: flex-start; gap: 8px; }
.ap-tier-list svg { color: var(--ap-green-dark); margin-top: 2px; }
.ap-tier .ap-btn { margin-top: auto; }
.ap-buy .ap-form { padding-bottom: 12px; }

/* settings */
.ap-settings-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.ap-fx { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin: 8px 0 12px; }
.ap-flow { list-style: none; margin: 0; padding: 0; }
.ap-flow-step { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 12px; padding: 14px 0; border-top: 1px solid var(--border-primary); opacity: .65; }
.ap-flow-step:first-child { border-top: 0; }
.ap-flow-step.is-now, .ap-flow-step.is-done { opacity: 1; }
.ap-flow-step.is-done .ap-step-n { background: var(--ap-green); border-color: #1f9a0c; }
.ap-flow-step.is-now .ap-step-n { background: #201d19; border-color: #201d19; color: #f9f8ee; }
.ap-flow-title { margin: 3px 0 2px; font-weight: 500; }
.ap-flow-now { font-size: 14px; margin: 6px 0 0; }

/* --------------------------------------------------------------- responsive */
@media (max-width: 1279px) {
  .ap-cards--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ap-tiers { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ap-tx-head, .ap-tx-row { grid-template-columns: 36px 150px minmax(0, 1fr) 110px 130px 40px; }
}
@media (max-width: 1199px) {
  .ap-pf { grid-template-columns: minmax(0, 1fr); }
  .ap-pf-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); column-gap: 20px; padding: 4px 24px; }
  .ap-pf-stats .ap-stat:last-child { border-bottom: 1px solid var(--border-primary); }
  .ap-onboard { grid-template-columns: minmax(0, 1fr); gap: 24px; }
}
@media (max-width: 1023px) {
  .ap-root, .ap-root.is-collapsed { grid-template-columns: minmax(0, 1fr); }
  .ap-root.is-collapsed .ap-side { visibility: visible; overflow-y: auto; border-right: 1px solid var(--border-primary); }
  .ap-main, .ap-toasts { grid-column: 1; }
  .ap-side { position: fixed; top: 0; bottom: 0; left: 0; z-index: 90; width: min(320px, 88vw); transform: translateX(-105%); visibility: hidden; transition: transform .2s ease, visibility 0s linear .2s; box-shadow: 0 0 40px rgba(32, 29, 25, .18); }
  .ap-side.is-open { transform: none; visibility: visible; transition: transform .2s ease; }
  .ap-root.is-collapsed .ap-side:not(.is-open) { visibility: hidden; }
  .ap-side-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: var(--ap-top); padding: 0 8px 0 16px; border-bottom: 1px solid var(--border-primary); }
  .ap-side-scrim:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 85; background: rgba(32, 29, 25, .4); }
  .ap-page { padding: 32px 28px 56px; }
  .ap-banner { padding: 10px 28px; }
  .ap-wallet { grid-template-columns: minmax(0, 1fr) auto; }
  .ap-wallet-meta { grid-column: 1 / -1; grid-row: 2; }
  .ap-report { grid-template-columns: 40px minmax(0, 1fr); }
  .ap-report-actions { grid-column: 2 / -1; justify-content: flex-start; }
  .ap-tx-head, .ap-tx-row { grid-template-columns: 36px 140px minmax(0, 1fr) 100px 96px 40px; }
  .ap-tx-proto { display: none; }
}
@media (max-width: 767px) {
  .ap-body { font-size: 15px; }
  /* top bar, scroll box, toast row, tab bar: the tab bar is a row below the scroll box, never over it, so content
     ends at its top edge at every scroll position and the last control always scrolls clear of it */
  .ap-root { grid-template-rows: var(--ap-top) minmax(0, 1fr) auto auto; }
  .ap-top { padding: 0 8px 0 4px; gap: 4px; }
  .ap-top-help, .ap-top-sync { display: none; }
  .ap-brand-word, .ap-brand-word svg, .ap-brand-word-svg { height: 15px; }
  .ap-tabbar { grid-row: 4; grid-column: 1; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); height: calc(var(--ap-tab) + env(safe-area-inset-bottom, 0px)); padding-bottom: env(safe-area-inset-bottom, 0px); background: var(--bg-secondary); border-top: 1px solid var(--border-primary); z-index: 50; }
  .ap-tab { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-width: 0; border: 0; background: transparent; color: var(--text-secondary); font-size: 11px; text-decoration: none; cursor: pointer; }
  .ap-tab > span:not(.ap-badge) { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 2px; }
  .ap-tab.is-active { color: var(--text-primary); }
  .ap-tab.is-active::before { content: ''; position: absolute; top: 0; left: 28%; right: 28%; height: 3px; border-radius: 0 0 3px 3px; background: var(--ap-green); }
  .ap-badge--tab { position: absolute; top: 5px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; font-size: 11px; }
  .ap-toasts { grid-row: 3; padding: 8px 12px; }
  .ap-sheet-toasts { padding: 8px 16px; }
  .ap-page { padding: 24px 16px 40px; }
  .ap-banner { padding: 10px 16px; }
  .ap-h1 { font-size: 1.875rem; letter-spacing: -.03rem; }
  .ap-display { font-size: 1.875rem; }
  .ap-head { margin-bottom: 20px; }
  .ap-pad { padding: 14px 16px; }
  .ap-pad-x { padding-left: 16px; padding-right: 16px; }
  .ap-rows { padding: 0 16px; }
  .ap-section-head { padding: 0 16px 14px; }
  .ap-input, .ap-select { font-size: 16px; }
  .ap-hide-phone { display: none !important; }
  .ap-show-phone { display: inline; }
  .ap-cards--3 { grid-template-columns: minmax(0, 1fr); }
  .ap-grid-2, .ap-grid-3, .ap-controls, .ap-settings-grid, .ap-add-form { grid-template-columns: minmax(0, 1fr); }
  .ap-controls { padding: 16px; }
  .ap-add { padding: 16px; }
  .ap-kpi { padding: 16px; }
  .ap-kpi-value { font-size: 1.5rem; }
  .ap-pf-chart { padding: 18px 16px 16px; }
  .ap-pf-balance { font-size: 1.875rem; }
  .ap-chart { height: 180px; margin: 12px -16px 0; }
  .ap-chart-foot { flex-direction: column; align-items: stretch; }
  .ap-pills { flex-wrap: nowrap; }
  .ap-pill { flex: 1 1 0; min-width: 0; padding: 0 4px; }
  .ap-pf-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 16px; padding: 4px 16px; }
  .ap-stat-value { font-size: 1.125rem; }
  .ap-onboard-steps { padding: 0 16px; }
  .ap-table--cards thead { display: none; }
  .ap-table--cards, .ap-table--cards tbody { display: block; }
  .ap-table--cards tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px; padding: 14px 16px; border-bottom: 1px solid var(--border-primary); }
  .ap-table--cards tr:last-child { border-bottom: 0; }
  .ap-table--cards td, .ap-table--cards td:first-child, .ap-table--cards td:last-child { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 0; border: 0; text-align: left; white-space: normal; min-width: 0; overflow-wrap: anywhere; }
  .ap-table--cards td:first-child { grid-column: 1 / -1; }
  .ap-table--cards td::before { content: attr(data-label); font-size: 12px; color: var(--ap-muted); }
  .ap-table--cards td[data-label=""]::before, .ap-table--cards td:first-child::before { display: none; }
  .ap-table--cards td.ap-tags-cell { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; gap: 6px; }
  .ap-table--cards td.ap-tags-cell > * + * { margin-left: 0; }
  .ap-table--cards td.ap-cell-actions { grid-column: 1 / -1; }
  .ap-asset-sub { max-width: 100%; }
  .ap-wallet { grid-template-columns: minmax(0, 1fr) auto; padding: 14px 16px; gap: 12px; }
  .ap-wallet-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ap-wallet-meta > div:last-child { grid-column: 1 / -1; }
  .ap-tx-toolbar { padding: 12px 16px; }
  .ap-tx-bar { padding: 6px 16px; }
  .ap-tx-row { grid-template-columns: 40px minmax(0, 1fr) auto 36px; grid-template-areas: "check type value edit" "check legs legs edit" "check flags flags edit"; row-gap: 6px; column-gap: 8px; align-content: center; padding: 8px 8px 8px 8px; }
  .ap-tx-check { grid-area: check; width: 40px; height: 40px; }
  .ap-tx-type { grid-area: type; }
  .ap-tx-legs { grid-area: legs; font-size: 14px; }
  .ap-tx-value { grid-area: value; font-size: 15px; }
  .ap-tx-flags { grid-area: flags; min-height: 24px; }
  .ap-tx-edit { grid-area: edit; }
  .ap-tx-group { padding: 0 12px; gap: 10px; font-size: 12px; }
  .ap-tx-wallet, .ap-tx-fee { display: none; }
  .ap-rv-item { grid-template-columns: minmax(0, 1fr); padding: 14px 16px; }
  .ap-rv-fixes { justify-content: flex-start; max-width: none; }
  .ap-report { grid-template-columns: 32px minmax(0, 1fr); padding: 14px 16px; gap: 10px 12px; }
  .ap-report-ico { width: 32px; height: 32px; }
  .ap-report-actions { grid-column: 1 / -1; }
  .ap-gate { margin: 0 16px 12px; }
  .ap-price-row { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .ap-layer, .ap-layer--drawer { align-items: flex-end; justify-content: center; padding: 0; }
  .ap-sheet, .ap-sheet--drawer, .ap-sheet--sm, .ap-sheet--lg { max-width: 100%; height: auto; max-height: 92vh; max-height: 92dvh; border-radius: 16px 16px 0 0; border-width: 1px 0 0; transform: translateY(24px); }
  .ap-sheet-body { padding: 8px 16px 16px; }
  .ap-sheet-foot { padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)); }
  .ap-sheet-foot .ap-btn { flex: 1 1 120px; }
  .ap-sheet-head { padding: 12px 8px 4px 16px; }
  .ap-sheet-title { font-size: 1.25rem; }
  .ap-preview-frame { height: 64vh; }
  .ap-search--s { flex: 1 1 100%; }
}
@media (max-width: 559px) {
  .ap-cards--4, .ap-tiers { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 479px) {
  .ap-wallet-chip { padding: 0 6px; }
  .ap-wallet-chip-text { display: none; }
  .ap-connect span { display: none; }
  .ap-connect { padding: 6px 11px; min-width: 40px; }
  .ap-pf-stats { grid-template-columns: minmax(0, 1fr); }
  .ap-sheet .ap-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* a wallet row is one column: name and address, then the counts, then Resync and the menu on their own row,
     so the Copy button next to the address never reaches the actions column */
  .ap-wallet { grid-template-columns: minmax(0, 1fr); }
  .ap-wallet-meta { grid-column: 1; }
  .ap-wallet-actions { justify-content: flex-end; }
  .ap-wallet-addr .ap-mono { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
@media (max-width: 359px) {
  .ap-brand-word, .ap-brand-word svg, .ap-brand-word-svg { height: 13px; }
  .ap-tab { font-size: 10px; }
  .ap-tab > span:not(.ap-badge) { padding: 0; }
  .ap-tx-group .ap-tx-date { max-width: 120px; overflow: hidden; text-overflow: ellipsis; }
}
/* touch: every standalone control is at least 40 px (SPEC section 2). This block comes after every base rule it
   grows, so it wins the cascade; the info helper grows its line instead of laying its tap area over the value under
   it, and the transactions group row is 40 px on phones (transactions.js dims) so its explorer link fills it */
@media (pointer: coarse) {
  .ap-btn--sm { min-height: 40px; }
  .ap-icon-btn--xs { width: 40px; height: 40px; }
  .ap-info { width: 40px; height: 40px; }
  .ap-stat-label { min-height: 40px; }
  .ap-pill { height: 40px; }
  .ap-tx-hash { min-height: 40px; }
  .ap-connect { min-width: 40px; }
  .ap-chip { min-height: 40px; border-radius: 20px; }
  .ap-chip-x { width: 40px; height: 40px; }
  .ap-section-head .ap-link { min-height: 40px; }
}
@media (prefers-reduced-motion: reduce) {
  .ap-side, .ap-sheet, .ap-scrim, .ap-toast, .ap-bar span { transition: none !important; }
  .ap-dot[data-state="syncing"] { animation: none; }
}

/* ------------------------------------------------------------------ verify */
.vf { padding-bottom: 72px; }
.vf-hero { padding-top: 48px; }
.vf-eyebrow { margin: 0; font-family: var(--font-label); text-transform: uppercase; letter-spacing: .06em; font-size: 13px; color: var(--text-secondary); }
.vf-title { margin: 14px 0 18px; font-family: var(--font-heading); font-weight: 400; text-transform: uppercase; font-size: clamp(2.125rem, 6vw, 4.75rem); line-height: .96; letter-spacing: -.05em; max-width: 15ch; overflow-wrap: anywhere; }
.vf-lead { margin: 0; max-width: 62ch; font-size: 1.125rem; color: var(--text-secondary); }
.vf-panel { margin-top: 32px; max-width: 860px; padding: 24px; border: 1px solid var(--border-primary); border-radius: 16px; background: var(--ap-card); min-width: 0; }
.vf-label { display: block; margin-bottom: 8px; font-size: 15px; }
.vf-row { display: flex; gap: 8px; min-width: 0; }
.vf-input { flex: 1 1 auto; font-family: var(--font-label); font-size: 14px; }
.vf-submit { flex: none; }
.vf-drop { margin-top: 16px; padding: 20px; border: 1.5px dashed var(--border-secondary); border-radius: 12px; text-align: center; color: var(--text-secondary); transition: background-color .15s, border-color .15s; }
.vf-drop.is-over { background: #e9f8e3; border-color: var(--ap-green-dark); }
.vf-drop svg { margin: 0 auto 6px; display: block; }
.vf-drop-text { margin: 0; color: var(--text-primary); }
.vf-drop-sub { margin: 4px 0 0; font-size: 14px; }
.vf-file { position: relative; color: var(--ap-green-dark); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.vf-file input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.vf-file:focus-within { outline: 2px solid var(--focus-ring, #1a7a0e); outline-offset: 2px; }
.vf-result { margin-top: 16px; }
.vf-result:empty { display: none; }
.vf-card { display: flex; gap: 14px; padding: 18px; border-radius: 12px; border: 1px solid var(--border-primary); background: var(--bg-secondary); min-width: 0; }
.vf-card > div { min-width: 0; flex: 1; }
.vf-card p { margin: 0 0 6px; overflow-wrap: anywhere; }
.vf-card.is-valid { background: #e9f8e3; border-color: #bfe9b0; }
.vf-card.is-superseded { background: #fbf3dc; border-color: #eedba6; }
.vf-card.is-missing { background: #fbe9e4; border-color: #efc2b5; }
.vf-card-ico { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 50%; background: #fffef8; flex: none; }
.vf-card-title { font-size: 1.25rem; font-weight: 500; }
.vf-dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px 16px; margin: 14px 0; }
.vf-dl dt { font-size: 13px; color: var(--ap-muted); }
.vf-dl dd { margin: 2px 0 0; overflow-wrap: anywhere; }
.vf-mono { font-family: var(--font-label); font-size: 13px; overflow-wrap: anywhere; word-break: break-all; }
.vf-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.vf-how { margin-top: 72px; }
.vf-h2 { margin: 0 0 24px; font-family: var(--font-heading); font-weight: 400; text-transform: uppercase; font-size: clamp(1.75rem, 4vw, 2.5rem); letter-spacing: -.04em; line-height: 1; }
.vf-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.vf-steps li { border-top: 1px solid var(--border-primary); padding-top: 16px; min-width: 0; }
.vf-steps h3 { margin: 10px 0 8px; font-size: 1.125rem; font-weight: 500; }
.vf-steps p { margin: 0; color: var(--text-secondary); }
.vf-step-n { font-family: var(--font-label); font-size: 13px; color: var(--text-secondary); }
@media (max-width: 767px) {
  .vf-hero { padding-top: 28px; }
  .vf-panel { padding: 16px; }
  .vf-row { flex-direction: column; }
  .vf-submit { width: 100%; }
  .vf-steps { grid-template-columns: minmax(0, 1fr); }
  .vf-card { flex-direction: column; }
  .vf-input { font-size: 16px; }
}
