/* FlipFinder — mobile web (≤767px). Loaded via a media-gated <link>, so nothing
   here can touch the desktop layout. Structure follows the Claude Design
   "FlipFinder — mobile web" canvas: bottom tab bar, card-first feeds, sticky
   action bars, compact KPI tiles. No build step. */

/* ═══════════ App shell ═══════════ */
body.app { display: block; }
.sidebar { display: none; }
.main { min-height: 100vh; display: flex; flex-direction: column; }

.content {
  padding: 16px 15px calc(70px + env(safe-area-inset-bottom));
  flex: 1;
}
.stack { gap: 16px; }

/* Topbar → compact header with the brand mark */
.topbar {
  height: 54px; padding: 0 15px; gap: 10px;
}
.topbar::before {
  content: ""; width: 22px; height: 22px; flex: none;
  background: linear-gradient(135deg, #7c5cff, #22d3ee);
  clip-path: polygon(0 0, 100% 0, 100% 62%, 62% 100%, 0 100%);
}
.topbar__title { font-size: 16px; font-weight: 800; letter-spacing: -0.3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar__crumb { display: none; }
.topbar__actions { margin-left: auto; gap: 8px; }
.topbar__search { display: none; }
.topbar__actions > .btn { display: none; }   /* Add is a bottom tab */
.topbar__btn { display: none; }               /* Alerts is a bottom tab */

.flashes { padding: 12px 15px 0; }
.btn { white-space: nowrap; }

/* ═══════════ Bottom tab bar ═══════════ */
.mnav[hidden] {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
  background: #0a0b0f; border-top: 1px solid var(--line-strong);
  padding: 9px 4px calc(9px + env(safe-area-inset-bottom));
}
.mnav__item {
  all: unset; box-sizing: border-box; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  min-height: 46px; color: var(--text-dim);
}
.mnav__ico { position: relative; display: flex; }
.mnav__ico svg { width: 21px; height: 21px; display: block; }
.mnav__label { font-size: 10px; font-weight: 600; letter-spacing: 0.03em; }
.mnav__item.is-on { color: var(--text); }
.mnav__item.is-on .mnav__ico { color: var(--violet); }
.mnav__item.is-on::after {
  content: ""; position: absolute; bottom: 1px; width: 16px; height: 2px; background: var(--violet);
}
.mnav__badge {
  position: absolute; top: -5px; right: -10px;
  background: var(--grad-hot); color: #07080b;
  font-family: var(--font-mono); font-size: 9px; font-weight: 600; padding: 1px 4px; line-height: 1.4;
}

/* ═══════════ Sign in ═══════════ */
body.auth { display: block; min-height: 100vh; }
.auth__aside { display: none; }
.auth__panel {
  min-height: 100vh; padding: 20px 24px 32px;
  background:
    radial-gradient(420px 320px at 92% 6%, rgba(124, 92, 255, 0.30), transparent 70%),
    radial-gradient(380px 300px at 4% 94%, rgba(34, 211, 238, 0.14), transparent 70%),
    var(--bg);
  justify-content: flex-start; gap: 40px; border-right: 0;
}
.auth__card { max-width: none; margin-top: auto; }
.auth__card form { gap: 14px; }
.auth__card input[type="email"],
.auth__card input[type="password"],
.auth__card input[type="text"] { min-height: 48px; padding: 14px; font-size: 15px; }
.auth__card button[type="submit"], .auth__card .button { min-height: 52px; font-size: 15px; text-align: center; justify-content: center; }
.auth__panel > .mono.small { margin-bottom: 8px; }

/* ═══════════ KPI tiles (dashboard + inventory) ═══════════ */
.kpigrid { grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); }
.kpi { border: 0; padding: 14px 15px; }
.kpi--ruled { padding: 0; }
.kpi__pad { padding: 14px 15px; }
.kpi__label { font-size: 9.5px; letter-spacing: 0.1em; }
.kpi__value { font-size: 24px; margin-top: 7px; letter-spacing: -0.8px; }
.kpi__foot { flex-direction: column; align-items: flex-start; gap: 2px; margin-top: 6px; }
/* profit tile reads as the hero number */
.kpigrid .kpi:first-child .kpi__value,
.kpi--ruled:first-child .kpi__value {
  background: var(--grad-mint); -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ═══════════ Dashboard — deal feed ═══════════ */
.layouttoggle { display: none; }
.dash-grid, .deals-grid { display: block; }
.dash-grid > .panel, .dash-grid > .panel--flush, .dash-grid > .stack > .panel { margin-bottom: 16px; }
.deals-grid .kpi-rail { position: static; margin-top: 16px; }

/* deal rows → cards */
.panel--flush:has(> .dealrow) { border: 0; padding: 0; }
.panel--flush:has(> .dealrow) > .panel__head { padding: 4px 2px 12px; border: 0; }
.dealrow {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 12px;
  padding: 14px 15px; border: 1px solid var(--line); border-top-width: 2px;
  margin: 0 0 12px;
}
.dealrow[data-tier="hot"] { border-top-color: var(--mint); }
.dealrow[data-tier="fair"] { border-top-color: var(--violet); }
.dealrow[data-tier="pass"] { border-top-color: var(--hot); }
.dealrow .min-w-0 { grid-column: 1; }
.dealrow .watchrow__label { font-size: 15px; font-weight: 700; white-space: normal; line-height: 1.3; }
.dealrow .r.pos { grid-column: 1; text-align: left; font-size: 15px; margin-top: 4px; }
.dealrow .r.pos .muted { font-size: 12px; }
.dealrow .ring { grid-row: 1 / span 2; grid-column: 2; align-self: center; width: 44px; height: 44px; }
.dealrow .ring svg { width: 44px; height: 44px; }
.dealrow .ring__num { font-size: 13px; }
.panel__head { padding: 15px; }
.panel { padding: 15px; }

/* watch movement / recent sales rows breathe a little */
.watchrow { grid-template-columns: 1fr auto; padding: 13px 15px; }
.watchrow .spark { display: none; }
.comprow { padding: 12px 15px; }

/* ═══════════ Listings — scan list ═══════════ */
.filters { position: sticky; top: 54px; z-index: 56; background: var(--bg); margin: -16px -15px 14px; padding: 12px 15px; border-bottom: 1px solid var(--line); }

/* trigger — opens the sheet */
.filters__trigger[hidden] {
  display: flex; align-items: center; gap: 9px;
  width: 100%; height: 44px; padding: 0 14px;
  background: var(--field); border: 1px solid var(--line-strong); color: var(--text);
  font-family: var(--font-ui); font-size: 13px; font-weight: 600; letter-spacing: 0.01em; cursor: pointer;
}
.filters__trigger svg { width: 16px; height: 16px; flex: none; }
.filters__trigger-dot { margin-left: auto; width: 8px; height: 8px; background: var(--grad-violet); }

/* .chips → slide-up bottom sheet */
.fsheet-backdrop[hidden] {
  display: block; position: fixed; inset: 0; z-index: 50;
  background: rgba(5, 6, 9, 0.7);
  opacity: 0; pointer-events: none; transition: opacity 0.2s ease;
}
.fsheet-backdrop.is-open { opacity: 1; pointer-events: auto; }

.chips {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 55;
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-content: start;
  max-height: 84vh; overflow-y: auto;
  padding: 16px 15px calc(18px + env(safe-area-inset-bottom));
  background: var(--panel);
  border-width: 2px 0 0; border-style: solid; border-image: var(--grad-violet) 1;
  transform: translateY(112%); transition: transform 0.26s cubic-bezier(0.22, 1, 0.36, 1);
}
.chips.is-open { transform: none; }

.chips__head[hidden] { display: flex; align-items: center; justify-content: space-between; grid-column: 1 / -1; }
.chips__head-title { font-size: 15px; font-weight: 700; }
.chips__close { all: unset; cursor: pointer; font-size: 22px; line-height: 1; color: var(--text-dim); padding: 2px 8px; }

.chips__q { grid-column: 1 / -1; min-width: 0; width: 100%; height: 44px; padding: 0 13px; }
.chips > select { height: 42px; padding: 0 10px; width: 100%; }
.chips__num { gap: 6px; height: 42px; border: 1px solid var(--line-strong); padding: 0 10px; font-size: 11px; white-space: nowrap; flex-wrap: nowrap; }
.chips__num input { flex: 1; width: auto; min-width: 0; border: 0; background: transparent; padding: 0; font-size: 13px; }

.chips__apply {
  grid-column: 1 / -1; height: 52px; justify-content: center; margin-top: 4px;
  background: var(--grad-violet); color: #fff; border: 0; font-size: 14px; font-weight: 700;
}
.chips__apply-d { display: none; }
.chips__apply-m[hidden] { display: inline; }
.chips__reset { grid-column: 1 / -1; height: 44px; justify-content: center; }

.ltable__head { display: none; }
.ltable__row {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 15px; border-bottom: 1px solid var(--line);
  border-left: 3px solid transparent;
}
.ltable__row[data-tier="hot"] { border-left-color: var(--mint); }
.ltable__row[data-tier="fair"] { border-left-color: var(--violet); }
.ltable__row[data-tier="pass"] { border-left-color: var(--hot); }
.ltable__row > .small,                       /* source col */
.ltable__row > .r.mono:not(.lcell-net) { display: none; }   /* ask / est / margin / age */
.ltable__row .thumb { width: 34px; height: 34px; }
.lcell-item { flex: 1; min-width: 0; }
.lcell-item__title {
  font-size: 14px; white-space: normal; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.lcell-item__text > .mono.small.muted:not(.lcell-item__sub) { display: none; }
.lcell-item__sub[hidden] { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 4px; }
.ltable__row > .lcell-net { display: block; flex: none; text-align: right; font-size: 15px; }
.ltable__row > .lcell-score { flex: none; }
.lcell-score .ring { width: 38px; height: 38px; }
.lcell-score .ring svg { width: 38px; height: 38px; }
.lcell-score .ring__num { font-size: 11px; }
.lcell-score .scorebar { width: 64px; }
.pager { padding: 14px 15px; }

/* ═══════════ Item detail ═══════════ */
.backlink { margin: 2px 0 12px; }
.detail-head__body { display: block; padding: 0; }
.detail-head__body > .detail-photo { width: 100%; height: 180px; aspect-ratio: auto; border: 0; border-bottom: 1px solid var(--line); }
.detail-head__body > div:nth-child(2) { padding: 16px 15px; }
.detail-head__aside { flex-direction: row; align-items: center; gap: 16px; padding: 16px 15px; border-top: 1px solid var(--line); }
.detail-head__aside .ring--lg { width: 72px; height: 72px; flex: none; }
.detail-head__aside .ring--lg svg { width: 72px; height: 72px; }
.detail-head__aside .ring--lg .ring__num { font-size: 19px; }
.statrow { gap: 14px 20px; margin-top: 16px; }
.statrow > div { min-width: 40%; flex: 1; }
.statrow__v { font-size: 17px; }

/* actions → sticky bottom bar above the tab bar */
.detail-head__aside .actions {
  position: fixed; left: 0; right: 0; z-index: 30;
  bottom: calc(63px + env(safe-area-inset-bottom));
  flex-direction: row; flex-wrap: wrap; width: auto; gap: 8px;
  padding: 10px 15px;
  background: #0a0b0f; border-top: 1px solid var(--line-strong);
}
.detail-head__aside .actions > * { flex: 1; }
.detail-head__aside .actions > a[href^="http"] { flex-basis: 100%; }   /* "Open on <source>" gets its own row */
.detail-head__aside .actions .btn { justify-content: center; height: 46px; font-size: 12.5px; }
.detail-head__aside .actions form { display: flex; }
.detail-head__aside .actions form .btn { width: 100%; }

.detail-grid { display: block; padding-bottom: 96px; }
.detail-grid > .panel { margin-bottom: 16px; }
.detail-grid > .stack { gap: 16px; }
.breakdown__row { grid-template-columns: 1fr auto; row-gap: 6px; }
.breakdown__row .breakdown__track { grid-column: 1 / -1; order: 3; }
.histchart { height: 150px; }

/* ═══════════ Add listing ═══════════ */
.formgrid { grid-template-columns: 1fr; }
.formgrid .fieldlbl input, .formgrid .fieldlbl select, .formgrid .fieldlbl textarea { min-height: 46px; font-size: 15px; }
.fieldlbl.span2 { grid-column: 1; }
.detail-grid > .stack + .panel {           /* the projection panel */
  position: sticky; bottom: calc(70px + env(safe-area-inset-bottom));
  z-index: 20; margin: 0 -15px; border-left: 0; border-right: 0;
}
.detail-grid > .stack + .panel .calcrows,
.detail-grid > .stack + .panel > .mono.small.muted { display: none; }
.detail-grid > .stack + .panel > div[style*="font-size:34px"] { font-size: 28px !important; margin: 10px 0 !important; }

/* ═══════════ Inventory ═══════════ */
.invtabs { overflow-x: auto; flex-wrap: nowrap; padding: 12px 15px; scrollbar-width: none; }
.invtabs::-webkit-scrollbar { display: none; }
.invtabs .invtab { flex: none; white-space: nowrap; }
.invtabs > span[style] { display: none; }   /* CSV / Add — Add is a tab, CSV is desktop */

.itable__head { display: none; }
.itable__row {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 15px; border-bottom: 1px solid var(--line);
  border-left: 3px solid transparent;
}
.itable__row[data-tier="hot"] { border-left-color: var(--mint); }
.itable__row[data-tier="fair"] { border-left-color: var(--violet); }
.itable__row[data-tier="pass"] { border-left-color: var(--hot); }
.itable__item { flex: 1; min-width: 0; }
.itable__title {
  white-space: normal; font-size: 14px; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.itable__item .mono.small.muted:not(.itable__sub) { display: none; }
.itable__sub[hidden] { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 4px; }
.itable__row > .r.mono:not(.itable-roi) { display: none; }   /* cost / fees / sold / days */
.itable__row > .itable-status { flex: none; }
.itable__row > .itable-roi { flex: none; text-align: right; font-size: 14px; }

/* the payout / aging blocks below the inventory table */
.stack > .dash-grid > .panel--flush { margin-bottom: 16px; }

/* ═══════════ Alerts drawer → full-screen sheet ═══════════ */
.drawer { top: 0; width: 100%; box-shadow: none; }
.drawer.is-open { z-index: 60; }
.drawer__head { padding: 16px 15px; padding-top: calc(16px + env(safe-area-inset-top)); }
.notif { padding: 15px; }

/* ═══════════ Workspace admin / review — keep readable, stack the grids ═══════════ */
.srcgrid { grid-template-columns: 1fr; }
.mtable__head { display: none; }
.mtable__row { grid-template-columns: 1fr; gap: 8px; padding: 14px 15px; }
.reviewrow { grid-template-columns: 1fr; gap: 10px; padding: 14px 15px; }
.reviewrow .rolepick, .reviewrow .btn { width: 100%; }
.inviterow { flex-wrap: wrap; }
.inviterow input { flex-basis: 100%; }
