/* Coconuts app UX (2026-11-03): bottom tabs on mobile, filters + saved views, palette, toasts, skeletons, card motion, onboarding.
   Brand palette only; WCAG AA; every animation off under prefers-reduced-motion (styles.css). */
.app-top { position: sticky; top: 0; z-index: 30; }
.top-actions { display: flex; gap: 6px; align-items: center; }
.icon-btn { border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 999px; min-width: 38px; height: 38px; padding: 0 10px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer; font: 600 13px var(--body); }
.icon-btn kbd { font: 600 11px var(--body); color: var(--muted); }
.navlink { color: var(--ink); text-decoration: none; padding: 6px 8px; border-radius: 8px; }
.navlink[aria-current="page"] { background: var(--sand); font-weight: 700; }

/* bottom tab bar (mobile) */
.btabs { display: none; }
@media (max-width: 720px) {
  .who .navlink { display: none; }
  .btabs { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--panel);
    border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .btabs a { display: grid; justify-items: center; gap: 2px; font: 600 11px var(--body); color: var(--muted); text-decoration: none; padding: 4px 0; border-radius: 10px; }
  .btabs a svg { width: 22px; height: 22px; }
  .btabs a[aria-current="page"] { color: var(--palm); background: var(--sand); }
  body.app { padding-bottom: 76px; }
  .app-top .tagline, .app-top #btn-out { display: none; }
  .app-top .who { margin-left: auto; }
  .top-actions .icon-btn kbd { display: none; }
}

/* filters + saved views */
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin: 6px 0 8px; }
.filters label { font-size: 12px; color: var(--muted); }
.filters input, .filters select { font-size: 14px; padding: 7px 8px; }
.views { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0 0 10px; }
.view-chip { border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 999px; padding: 4px 10px; font-size: 13px; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.view-chip.active { border-color: var(--palm); background: var(--sand); }
.view-chip .x { color: var(--muted); font-size: 12px; }

/* skeletons */
.skel-card { height: 148px; border-radius: var(--radius); border: 1px solid var(--line); background: linear-gradient(100deg, var(--panel) 30%, var(--sand) 50%, var(--panel) 70%);
  background-size: 300% 100%; animation: shimmer 1.4s infinite linear; }
@keyframes shimmer { to { background-position: -150% 0; } }

/* card motion: new cards slide in, a changed price ticks, stale cards fade (styles.css .expired) */
.card-in { animation: cardIn .45s cubic-bezier(.2,.7,.2,1) both; }
@keyframes cardIn { from { opacity: 0; transform: translateY(10px) scale(.985); } }
.ticked .odds { animation: tick 1.6s ease-out; border-radius: 4px; }
@keyframes tick { 0% { background: color-mix(in srgb, var(--sunset) 70%, transparent); } 100% { background: transparent; } }
.expired { transition: opacity .6s; }

/* toasts */
.toasts { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 60; display: grid; gap: 8px; width: min(92vw, 420px); }
@media (max-width: 720px) { .toasts { bottom: 86px; } }
.toast { display: flex; justify-content: space-between; gap: 12px; align-items: center; background: var(--ink); color: var(--bg); border-radius: 12px; padding: 10px 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,.25); animation: cardIn .25s both; font-size: 14px; }
.toast .link { color: var(--sunset); font-weight: 700; }
.toast.out { opacity: 0; transition: opacity .2s; }

/* command palette */
dialog.palette { border: 1px solid var(--line); border-radius: 18px; padding: 0; width: min(92vw, 560px); background: var(--panel); color: var(--ink); margin-top: 12vh; }
dialog.palette::backdrop, dialog.tshare::backdrop, dialog.onb::backdrop { background: rgba(15, 27, 45, .45); }
.palette input { width: 100%; border: 0; border-bottom: 1px solid var(--line); border-radius: 18px 18px 0 0; font-size: 17px; padding: 16px 18px; background: transparent; }
.palette input:focus { outline: none; }
.palette ul { list-style: none; margin: 0; padding: 6px; max-height: 50vh; overflow: auto; }
.palette li { display: flex; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: 10px; cursor: pointer; }
.palette li[aria-selected="true"] { background: var(--sand); }
.palette .fine { margin: 0; padding: 8px 14px 12px; }
kbd { border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; padding: 0 6px; font: 600 12px var(--body); background: var(--bg); }
.help-keys { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; align-items: center; }

/* tracker: swipe to settle, share */
.tbet.swipe { touch-action: pan-y; position: relative; transition: transform .15s; }
.tbet[data-hint="win"] { box-shadow: inset 6px 0 0 var(--palm); }
.tbet[data-hint="loss"] { box-shadow: inset -6px 0 0 var(--coral); }
dialog.tshare { border: 1px solid var(--line); border-radius: 18px; background: var(--panel); color: var(--ink); width: min(94vw, 640px); }
.tshare-prev { width: 100%; height: auto; border-radius: 12px; border: 1px solid var(--line); }

/* onboarding */
dialog.onb { border: 0; border-radius: 22px; background: var(--panel); color: var(--ink); width: min(94vw, 520px); padding: 22px; }
.onb-steps { display: flex; gap: 6px; margin-bottom: 12px; }
.onb-steps i { flex: 1; height: 4px; border-radius: 4px; background: var(--line); }
.onb-steps i.on { background: var(--palm); }
.onb h2 { margin: 6px 0; }
.onb .chips { display: flex; flex-wrap: wrap; gap: 6px; }
.onb-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; }
.coach { position: fixed; z-index: 55; max-width: 280px; background: var(--ink); color: var(--bg); border-radius: 14px; padding: 12px 14px; font-size: 14px; box-shadow: 0 12px 30px rgba(0,0,0,.3); }
.coach img { float: left; margin: 0 8px 4px 0; }
.coach .stack-row { margin-top: 8px; }
.coach .btn { padding: 6px 12px; font-size: 13px; }
.coach-ring { outline: 3px solid var(--sunset); outline-offset: 4px; border-radius: 12px; }

/* referral dashboard */
.ref-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ref-stats div { background: var(--sand); border-radius: 12px; padding: 10px; text-align: center; }
.ref-stats b { display: block; font: 700 22px var(--display); color: var(--palm); }
.signout-row { display: none; }
@media (max-width: 720px) { .signout-row { display: block; text-align: center; } }

/* admin funnel */
.fbar { display: grid; grid-template-columns: 170px 1fr 56px; gap: 8px; align-items: center; font-size: 14px; margin: 4px 0; }
.fbar-track { height: 14px; background: var(--sand); border-radius: 7px; overflow: hidden; }
.fbar-track i { display: block; height: 100%; background: var(--palm); border-radius: 7px; }
.fbar b { text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 560px) { .fbar { grid-template-columns: 120px 1fr 44px; } }

/* ===== Dashboard layout (Jake 2026-11-03: same look as the edgefinder dashboard; design ported, no code or data shared) ===== */
body.app { --gutter: 16px; --shadow: 0 2px 10px rgba(30, 42, 36, .07); --shadow-lift: 0 10px 24px rgba(30, 42, 36, .12); }
body.app main { max-width: 1240px; padding: 8px var(--gutter) 40px; }
.app-top { display: block; padding: 0; background: var(--bg); border-bottom: 0; }
.app-top .top-inner { max-width: 1240px; margin: 0 auto; padding: 14px var(--gutter); display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.app-top .brand { display: flex; align-items: center; gap: 12px; color: inherit; }
.app-top .palm-logo { width: 36px; height: 36px; border-radius: 12px; }
.app-top .word { font: 700 24px var(--display); color: var(--palm); }
.app-top .sub { color: var(--muted); font-size: 13px; font-family: var(--body); font-weight: 400; }
.app-top .status { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); flex-wrap: wrap; justify-content: flex-end; }
.app-top .status b { color: var(--ink); font-weight: 600; }
.app-top .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--muted); margin-right: 6px; vertical-align: -1px; }
.app-top .dot.on { background: var(--lagoon); box-shadow: 0 0 0 3px color-mix(in srgb, var(--lagoon) 25%, transparent); }
.app-top .dot.off { background: var(--coral); }
.shell { max-width: 1240px; margin: 0 auto; }
.greet { margin: 0; padding: 0 var(--gutter); font: 600 18px var(--display); color: var(--ink); }
.greet-sub { color: var(--muted); font: 500 14px var(--body); margin-left: 6px; }
.topbar { padding: 10px var(--gutter) 10px; display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.tb-total { position: relative; padding: 10px 18px 12px 18px; border-radius: var(--radius); background: var(--sand); box-shadow: var(--shadow); overflow: hidden; min-width: 280px; }
.tb-total::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: linear-gradient(180deg, #F5B841, #F28C5B 55%, #F26B5B); }
.tb-periods { display: flex; gap: 4px; margin-bottom: 4px; }
.tb-periods button { border: 0; background: transparent; color: var(--muted); font: 600 12px var(--body); padding: 2px 8px; border-radius: 999px; cursor: pointer; }
.tb-periods button[aria-pressed="true"] { background: var(--panel); color: var(--ink); box-shadow: var(--shadow); }
.tb-big { font: 700 34px var(--display); color: var(--ink); font-variant-numeric: tabular-nums; letter-spacing: -.01em; line-height: 1.1; min-height: 38px; }
.tb-big.neg { color: var(--neg, #B42318); }
.tb-empty { font: 600 19px var(--display); color: var(--ink); }
.tb-sub { font-size: 13px; color: var(--muted); margin-top: 2px; min-height: 22px; }
.tb-sub .btn { margin: 6px 0 0; }
.tb-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.tb-btn { display: flex; flex-direction: column; align-items: center; gap: 3px; width: 64px; padding: 8px 2px 6px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: var(--shadow); text-decoration: none; color: var(--ink); transition: transform 160ms ease, box-shadow 160ms ease; }
.tb-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.tb-bal { font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tb-bal.neg { color: var(--neg, #B42318); }
.tb-st { font-size: 10px; font-weight: 700; color: var(--muted); max-width: 60px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-add .plus { width: 34px; height: 34px; border-radius: 10px; border: 2px dashed var(--line); display: grid; place-items: center; font: 700 20px var(--display); color: var(--muted); }
.bbadge { display: inline-grid; place-items: center; border-radius: 10px; font: 800 13px var(--body); letter-spacing: -.02em; }
.wave { display: block; width: 100%; height: 12px; }
.wave path { fill: none; stroke: var(--lagoon); stroke-width: 1.5; opacity: .45; }
.simple-tabs { padding: 8px var(--gutter) 8px; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.simple-tabs::-webkit-scrollbar { display: none; }
.simple-tabs a { flex: none; border-radius: 999px; padding: 8px 18px; border: 1px solid var(--line); background: var(--panel); font: 600 15px var(--display); color: var(--ink); text-decoration: none; transition: background 160ms ease; }
.simple-tabs a:hover { background: var(--sand); }
.simple-tabs a.active { background: var(--palm); border-color: var(--palm); color: var(--on-palm); }
.simple-tabs a.adv { margin-left: auto; font-weight: 500; color: var(--muted); }
.simple-tabs a.adv.active { color: var(--on-palm); }
/* feed panel: Today on Coconuts, bankroll banner, best right now, pre/in-game pills */
.today-box { padding: 12px 16px; margin: 8px 0 12px; }
.today-box summary { display: flex; align-items: center; gap: 8px; }
.today-body ul { margin: 8px 0 4px; padding-left: 20px; }
.feed-panel { background: var(--sand); border-radius: var(--radius); padding: 12px 14px; margin: 0 0 12px; display: grid; gap: 10px; }
.bank-banner { margin: 0; background: color-mix(in srgb, var(--sunset) 22%, var(--panel)); border-radius: 10px; padding: 8px 12px; font-size: 14px; }
.best-now { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.best-list { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.best-item { background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; font-size: 13px; text-decoration: none; color: var(--ink); }
.best-kind { font-weight: 700; } .best-kind.lock { color: var(--palm); } .best-kind.value { color: var(--coconut); }
.best-up { font-size: 13px; color: var(--muted); }
.pills { display: flex; gap: 6px; }
.pill-f { border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 999px; padding: 5px 14px; font: 500 14px var(--body); cursor: pointer; }
.pill-f.active { background: var(--coconut); border-color: var(--coconut); color: #fff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .pill-f.active { color: #1E2A24; } }
:root[data-theme="dark"] .pill-f.active { color: #1E2A24; }
#view-feed .cards { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
.sc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 14px; }
.sc-card { padding: 14px 16px; overflow-x: auto; }
.sc-card h3 { margin: 0 0 8px; }
.learn-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.learn-grid .hub-card { display: block; text-decoration: none; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 14px 16px; }
.learn-grid .hub-card:hover { border-color: var(--palm); }
.learn-grid h3 { margin: 0 0 4px; font: 600 17px var(--display); color: var(--palm); }
.learn-grid p { margin: 0; font-size: 14px; }
@media (max-width: 720px) {
  .app-top .sub, .app-top #scan-run { display: none; }
  .app-top .top-inner { flex-wrap: nowrap; }
  .tb-total { min-width: 0; width: 100%; }
  .tb-buttons { flex-wrap: nowrap; overflow-x: auto; width: 100%; padding-bottom: 4px; }
  .tb-btn { flex: none; }
  .simple-tabs a.adv { margin-left: 0; }
  #view-feed .cards, .sc-grid { grid-template-columns: 1fr; }
}
.upsell-details summary { cursor: pointer; font-weight: 700; color: var(--palm); margin-top: 6px; }
.upsell-details[open] summary { margin-bottom: 8px; }

/* Phase 3.2: quick calc + card detail sparkline */
details.qcalc { margin-top: 8px; padding: 8px 10px; border-radius: 10px; background: var(--sand); border: 0; }
details.qcalc output { display: grid; gap: 4px; margin-top: 6px; font-variant-numeric: tabular-nums; }
.spark { width: 100%; height: 60px; } .spark polyline { fill: none; stroke: var(--palm); stroke-width: 2; }
dialog.card-detail { max-width: min(94vw, 520px); }

/* Phase 3.4 onboarding: progress dots + Coco tip */
.onb-dots { display: flex; gap: 8px; justify-content: center; margin-bottom: 10px; }
.onb-dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--line); transition: transform .2s, background .2s; }
.onb-dots i.done { background: var(--lagoon); } .onb-dots i.on { background: var(--palm); transform: scale(1.25); }
.onb-tip { display: flex; gap: 8px; align-items: center; background: var(--sand); border-radius: 12px; padding: 8px 10px; font-size: 14px; }

/* Phase 3.6: install bar + safe areas (notch / home indicator) */
.install-bar { position: fixed; left: 12px; right: 12px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 45; display: flex; gap: 10px; align-items: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 10px 12px; box-shadow: 0 12px 30px rgba(0,0,0,.18); font-size: 14px; }
.install-bar span { flex: 1; }
@media (max-width: 720px) { .install-bar { bottom: calc(84px + env(safe-area-inset-bottom)); } }
@media (display-mode: standalone) { .app-top .top-inner { padding-top: calc(14px + env(safe-area-inset-top)); } }
.app-top .top-inner, .shell, body.app main { padding-left: max(var(--gutter), env(safe-area-inset-left)); padding-right: max(var(--gutter), env(safe-area-inset-right)); }
