/* ============================================================
   Little Tracker - styles (v4)
   Cool teal palette: deep teal ink, teal accent, soft blue-grey
   base. Rounded + friendly, serif print names. Piece-card model.
   Palette: 022B3A / 1F7A8C / BFDBF7 / E1E5F2 / FFFFFF
   ============================================================ */

:root {
  --bg: #f8f3e9;
  --surface: #ffffff;
  --surface-2: #f2ecdd;
  --ink: #2c2418;
  --ink-soft: #7a705d;
  --ink-faint: #a99f8b;
  --line: #ece4d4;
  --line-strong: #ddd3bf;

  --accent: #4f74c9;
  --accent-deep: #3f60b0;
  --accent-ink: #33518f;
  --accent-soft: #e5ebf9;
  --accent-line: #c0cff0;

  --money: #4f7a5c;
  --money-soft: #eaf2ec;
  --sold: #8f96a0;
  --sold-soft: #eef0f2;
  --incoming: #b0803a;
  --incoming-soft: #f6ecd9;
  --rose: #d1738a;
  --rose-soft: #fbebef;

  /* Playful multicolor card palette (Intelly-style) */
  --c-yellow: #f4d44f; --c-yellow-deep: #e6c02f; --c-yellow-ink: #5f4e0e;
  --c-pink: #f6c0da; --c-pink-deep: #efa6c8; --c-pink-ink: #7a3350;
  --c-olive: #97a558; --c-olive-deep: #86954a; --c-olive-ink: #313c12;
  --c-blue: #abcbee; --c-blue-deep: #93b9e8; --c-blue-ink: #244a72;
  --c-yellow-soft: #fbf0c4; --c-pink-soft: #fbe3ef; --c-olive-soft: #e7ebd4; --c-blue-soft: #e3edfa;

  --shadow-sm: 0 2px 4px rgba(70,55,25,.05), 0 6px 18px rgba(70,55,25,.07);
  --shadow-md: 0 10px 30px rgba(70,55,25,.12);
  --shadow-lg: 0 -14px 46px rgba(50,40,20,.16);

  --font: "Poppins", ui-rounded, "SF Pro Rounded", -apple-system, system-ui, sans-serif;
  --serif: "Poppins", ui-rounded, system-ui, sans-serif;
  --r-xl: 26px;
  --r-lg: 22px;
  --r-md: 17px;
  --nav-h: 64px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg); color: var(--ink);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  overscroll-behavior: none;
}
button { font-family: inherit; cursor: pointer; color: inherit; }
input, select, textarea { font-family: inherit; font-size: 16px; color: var(--ink); }
.icon { display: inline-flex; align-items: center; justify-content: center; line-height: 0; }
.icon svg { display: block; }

/* ---------- Layout ---------- */
.app-shell { max-width: 1060px; margin: 0 auto; padding: 0 18px calc(var(--nav-h) + 44px + env(safe-area-inset-bottom)); min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 18px 2px 12px; background: linear-gradient(var(--bg) 76%, rgba(242,241,236,0));
}
.brand { display: flex; align-items: baseline; gap: 10px; min-width: 0; flex: 0 1 auto; }
.brand .word { font-family: var(--serif); font-weight: 700; font-size: 21px; letter-spacing: -0.02em; white-space: nowrap; }
.brand small { display: none; font-family: ui-rounded, system-ui, sans-serif; font-style: normal; font-size: 11.5px; color: var(--ink-soft); font-weight: 600; white-space: nowrap; }
.avatar-btn { display: inline-flex; align-items: center; gap: 9px; background: var(--surface); border: 1px solid var(--line); padding: 5px 13px 5px 5px; border-radius: 999px; box-shadow: var(--shadow-sm); font-weight: 650; font-size: 14px; flex: 0 1 auto; min-width: 0; max-width: 46vw; }
.avatar-btn .aname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.mono { width: 30px; height: 30px; border-radius: 999px; flex: none; display: grid; place-items: center; color: #fff; font-weight: 750; font-size: 12.5px; }

.tabs-desktop { display: none; gap: 6px; margin: 2px 0 20px; }
.tabs-desktop button { display: inline-flex; align-items: center; gap: 8px; border: none; background: transparent; color: var(--ink-soft); font-weight: 700; font-size: 14.5px; padding: 10px 17px; border-radius: 999px; cursor: pointer; transition: background .16s ease, color .16s ease, transform .16s ease; }
.tabs-desktop button .icon { color: var(--ink-faint); transition: color .16s ease; }
.tabs-desktop button:hover { background: var(--surface); color: var(--ink); }
.tabs-desktop button:hover .icon { color: var(--accent); }
.tabs-desktop button.active { background: var(--accent); color: #fff; box-shadow: 0 4px 14px rgba(79,116,201,.32); }
.tabs-desktop button.active:hover { background: var(--accent); color: #fff; }
.tabs-desktop button.active .icon { color: #fff; }

/* ---------- Dashboard color cards (Intelly-style) ---------- */
.dash-cards { display: grid; grid-template-columns: 1fr; gap: 14px; margin-bottom: 10px; }
.dcard { position: relative; overflow: hidden; border-radius: 22px; padding: 18px 20px; box-shadow: var(--shadow-sm); }
.dcard.yellow { background: var(--c-yellow); color: var(--c-yellow-ink); }
.dcard.pink { background: var(--c-pink); color: var(--c-pink-ink); }
.dcard.olive { background: var(--c-olive); color: var(--c-olive-ink); }
.dcard.blue { background: var(--c-blue); color: var(--c-blue-ink); }
.dcard-title { font-family: var(--serif); font-weight: 700; font-size: 16px; margin: 0 0 14px; position: relative; z-index: 1; }
.dcard-stats { display: flex; gap: 22px; flex-wrap: wrap; position: relative; z-index: 1; }
.dnum { font-size: 27px; font-weight: 800; letter-spacing: -0.02em; line-height: 1; }
.dlab { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; opacity: .62; margin-top: 6px; }
.dshape { position: absolute; top: -22px; right: -18px; opacity: .45; pointer-events: none; line-height: 0; transform: rotate(12deg); }
.dcard.yellow .dshape { color: var(--c-yellow-deep); }
.dcard.pink .dshape { color: var(--c-pink-deep); }
.dcard.olive .dshape { color: var(--c-olive-deep); }
.dcard.blue .dshape { color: var(--c-blue-deep); }
@media (min-width: 700px) { .dash-cards { grid-template-columns: 1fr 1fr; } }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(72px, 1fr)); gap: 10px; margin-bottom: 18px; }
.stat { background: var(--surface); border: none; border-radius: var(--r-md); padding: 13px; box-shadow: var(--shadow-sm); }
.stat .num { font-size: 21px; font-weight: 780; letter-spacing: -0.02em; }
.stat .lab { font-size: 11.5px; color: var(--ink-soft); font-weight: 600; margin-top: 3px; }
.stat.tap { cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .05s; }
.stat.tap:hover { border-color: var(--accent-line); }
.stat.tap:active { transform: scale(.98); }
.stat.tap.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }

/* ---------- Controls ---------- */
.controls { display: flex; flex-direction: row; align-items: center; gap: 10px; margin-bottom: 18px; }
.search { flex: 1; min-width: 0; display: flex; align-items: center; gap: 9px; background: var(--surface); border: none; border-radius: 16px; padding: 12px 15px; box-shadow: var(--shadow-sm); }
.scan-btn { flex: none; display: inline-flex; align-items: center; gap: 6px; background: var(--accent); color: #fff; border: none; border-radius: 13px; padding: 12px 15px; font-weight: 750; font-size: 14px; box-shadow: var(--shadow-sm); cursor: pointer; }
.scan-btn .icon { color: #fff; }
.scan-btn:hover { background: var(--accent-deep); }
.search .icon { color: var(--ink-faint); }
.search input { border: none; outline: none; background: transparent; width: 100%; }

/* ---------- Search header (white pill + filter button, plain background) ---------- */
.search-header { position: relative; margin-bottom: 14px; }
.search-row { display: flex; align-items: stretch; gap: 11px; }
.search-header .search { flex: 1; min-width: 0; border: none; border-radius: 16px; padding: 15px 16px; box-shadow: var(--shadow-sm); }
.filter-toggle { position: relative; flex: none; width: 54px; border: none; border-radius: 16px; background: var(--surface); color: var(--accent-deep); display: grid; place-items: center; box-shadow: var(--shadow-sm); cursor: pointer; }
.filter-toggle:active { transform: scale(.96); }
.filter-toggle.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.filter-toggle.has-active::after { content: ""; position: absolute; top: 8px; right: 8px; width: 9px; height: 9px; border-radius: 999px; background: var(--rose); border: 2px solid var(--surface); }

/* ---------- Theme icon row (tap a theme to filter) ---------- */
.theme-row { display: flex; gap: 15px; overflow-x: auto; -webkit-overflow-scrolling: touch; padding: 2px 2px 8px; margin-bottom: 14px; scrollbar-width: none; }
.theme-row::-webkit-scrollbar { display: none; }
.theme-tile { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 7px; border: none; background: none; padding: 0; cursor: pointer; }
.theme-ic { width: 58px; height: 58px; border-radius: 999px; background: var(--surface-2); color: var(--accent); display: grid; place-items: center; box-shadow: var(--shadow-sm); transition: background .15s ease, color .15s ease, transform .15s ease; }
.theme-tile:active .theme-ic { transform: scale(.93); }
.theme-tile.on .theme-ic { background: var(--accent); color: #fff; }
.theme-lbl { font-size: 11.5px; font-weight: 650; color: var(--ink-soft); white-space: nowrap; }
.theme-tile.on .theme-lbl { color: var(--accent-ink); font-weight: 750; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft); border-radius: 999px; padding: 8px 15px; font-weight: 680; font-size: 13.5px; box-shadow: var(--shadow-sm); }
.chip.active { background: var(--ink); color: #fff; border-color: var(--ink); }
/* sign-in screen */
.auth-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 32px 26px 28px; box-shadow: var(--shadow-md); text-align: center; }
.auth-mark { width: 52px; height: 52px; border-radius: 15px; background: var(--accent); color: #fff; display: grid; place-items: center; margin: 0 auto 16px; }
.auth-title { font-family: var(--serif); font-size: 25px; font-weight: 700; margin: 0 0 6px; }
.auth-sub { color: var(--ink-soft); font-size: 13.5px; line-height: 1.5; margin: 0 auto 22px; max-width: 300px; }
.auth-label { display: block; text-align: left; font-size: 12px; font-weight: 700; color: var(--ink-soft); margin-bottom: 7px; }
.auth-card .inp { margin-bottom: 12px; }
.auth-card .auth-label { margin-top: 2px; }
.auth-row { text-align: right; margin: -6px 0 12px; }
.auth-link { border: none; background: transparent; color: var(--accent-ink); font-weight: 650; font-size: 12.5px; cursor: pointer; }
.auth-or { display: flex; align-items: center; gap: 10px; color: var(--ink-faint); font-size: 12px; font-weight: 600; margin: 14px 0; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth-toggle { border: none; background: transparent; color: var(--accent-ink); font-weight: 700; font-size: 13.5px; margin-top: 14px; cursor: pointer; }
.auth-msg { font-size: 13px; font-weight: 600; min-height: 18px; line-height: 1.4; margin-top: 10px; }
.auth-msg.ok { color: var(--money); }
.auth-msg.err { color: var(--rose); }

/* filter + sort dropdown bar */
.filter-bar { display: none; gap: 10px; flex-wrap: wrap; margin: -4px 0 18px; }
.filter-bar.open { display: flex; }
.sel {
  flex: 1 1 150px; min-width: 0;
  appearance: none; -webkit-appearance: none;
  border: 1px solid var(--line); border-radius: 12px;
  background-color: var(--surface);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2383838d' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat; background-position: right 12px center;
  padding: 12px 36px 12px 15px;
  font-weight: 650; font-size: 14px; color: var(--ink);
  box-shadow: var(--shadow-sm); cursor: pointer;
}
.sel:focus { outline: none; border-color: var(--accent-line); }
.clear-filters {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); color: var(--ink-soft);
  padding: 12px 15px; font-weight: 650; font-size: 14px;
  box-shadow: var(--shadow-sm); cursor: pointer;
  transition: color .14s, border-color .14s;
}
.clear-filters:hover { color: var(--ink); border-color: var(--accent-line); }
.clear-filters.hidden { display: none; }

/* ---------- Grid ---------- */
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.card { position: relative; background: var(--surface); border: none; border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-sm); text-align: left; width: 100%; padding: 0; transition: transform .14s, box-shadow .14s; }
.card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.card:active { transform: scale(.988); }
.card.owned { box-shadow: var(--shadow-sm); }
.thumb { position: relative; aspect-ratio: 4/5; width: 100%; background: #fcfbf9; display: grid; place-items: center; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: contain; }
.thumb .ph { color: var(--ink-faint); display: grid; place-items: center; gap: 6px; font-size: 12px; font-weight: 600; }
.card .body { padding: 11px 13px 14px; }
.card .name { font-family: var(--serif); font-weight: 600; font-size: 15px; line-height: 1.2; letter-spacing: -0.01em; }
.card .date { font-size: 11.5px; color: var(--ink-faint); margin-top: 4px; font-weight: 550; }
.card .badges { display: flex; gap: 6px; margin-top: 9px; flex-wrap: wrap; }
.badge { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--ink-soft); display: inline-flex; align-items: center; gap: 4px; }
.badge.have { background: var(--accent-soft); color: var(--accent-ink); }
.badge.sold { background: var(--sold-soft); color: var(--sold); }
.badge.want { background: var(--rose-soft); color: var(--rose); }
.badge.incoming { background: var(--incoming-soft); color: var(--incoming); }
.badge.forsale { background: #fff; color: var(--accent-deep); border: 1px solid var(--accent-line); }
.corner { position: absolute; top: 9px; z-index: 2; width: 26px; height: 26px; border-radius: 999px; display: grid; place-items: center; box-shadow: var(--shadow-sm); }
.corner.check { right: 9px; background: var(--accent); color: #fff; }
.corner.wish { left: 9px; background: #fff; color: var(--rose); }

/* ---------- Pagination ---------- */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 14px 2px; }
.pg-btn { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 680; font-size: 14px; padding: 10px 15px; border-radius: 12px; box-shadow: var(--shadow-sm); }
.pg-btn:active { transform: scale(.97); }
.pg-btn[disabled] { opacity: .38; box-shadow: none; }
.pg-info { text-align: center; font-size: 13.5px; font-weight: 680; color: var(--ink); line-height: 1.2; }
.pg-info span { display: block; font-size: 11.5px; color: var(--ink-soft); font-weight: 550; margin-top: 2px; }

/* ---------- Bottom nav ---------- */
.nav { position: fixed; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 40; height: var(--nav-h); background: rgba(255,255,255,0.82); backdrop-filter: saturate(1.6) blur(18px); -webkit-backdrop-filter: saturate(1.6) blur(18px); border: 1px solid rgba(255,255,255,0.6); border-radius: 26px; box-shadow: 0 8px 28px rgba(70,55,25,.14); display: flex; padding: 0 4px; }
.nav button { position: relative; flex: 1; min-width: 0; border: none; background: transparent; color: var(--ink-soft); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-weight: 650; font-size: 10px; }
.nav button .icon { padding: 6px 12px; border-radius: 999px; display: inline-flex; transition: background .18s ease, color .18s ease, transform .18s ease; }
.nav button.active { color: var(--accent-deep); font-weight: 750; }
.nav button.active .icon { background: var(--accent); color: #fff; transform: translateY(-1px); }

/* ---------- Sheet ---------- */
.scrim { position: fixed; inset: 0; z-index: 60; background: rgba(28,26,24,0.44); opacity: 0; pointer-events: none; transition: opacity .22s; }
.scrim.open { opacity: 1; pointer-events: auto; }
.sheet { position: fixed; z-index: 61; left: 0; right: 0; bottom: 0; max-height: 94vh; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; display: flex; flex-direction: column; background: var(--bg); border-radius: 24px 24px 0 0; box-shadow: var(--shadow-lg); transform: translateY(102%); transition: transform .3s cubic-bezier(.32,.72,.31,1); padding: 0 0 calc(30px + env(safe-area-inset-bottom)); }
.sheet.open { transform: translateY(0); }
.hero { position: relative; width: 100%; flex-shrink: 0; aspect-ratio: 1/1; max-height: 350px; background: var(--surface-2); display: grid; place-items: center; overflow: hidden; border-radius: 24px 24px 0 0; }
.hero img { width: 100%; height: 100%; object-fit: contain; cursor: zoom-in; }
.hero .ph { color: var(--ink-faint); display: grid; place-items: center; gap: 6px; font-size: 13px; font-weight: 600; }
.hero .grip { position: absolute; top: 9px; left: 50%; transform: translateX(-50%); width: 40px; height: 5px; border-radius: 999px; background: rgba(0,0,0,.14); z-index: 3; }
.hero-btn { position: absolute; z-index: 3; border: none; width: 38px; height: 38px; border-radius: 999px; background: rgba(255,255,255,0.92); color: var(--ink); display: grid; place-items: center; box-shadow: var(--shadow-sm); backdrop-filter: blur(6px); }
/* On mobile the close X lives OUTSIDE the sheet as a viewport-fixed button
   (.sheet-close-fab), pinned to the screen so it can never be pushed off-screen
   or broken by iOS Safari sticky/overflow/transform quirks. The in-sheet
   .hero-btn.close is desktop-only (see the desktop media query). */
.hero-btn.close { display: none; }
.hero-btn.wish { display: none; }
.sheet-close-fab { position: fixed; top: calc(env(safe-area-inset-top) + 12px); right: 14px; z-index: 63; border: none; width: 42px; height: 42px; border-radius: 999px; background: rgba(255,255,255,0.96); color: var(--ink); display: grid; place-items: center; box-shadow: var(--shadow-md); backdrop-filter: blur(6px); cursor: pointer; }
.sheet-close-fab:active { transform: scale(.94); }
/* Product-detail action buttons (mobile) — back on the left, heart on the right,
   pinned to the screen so they're always reachable. Desktop uses in-hero buttons. */
.sheet-fab { position: fixed; top: calc(env(safe-area-inset-top) + 12px); z-index: 63; border: none; width: 44px; height: 44px; border-radius: 999px; background: rgba(255,255,255,0.97); color: var(--ink); display: grid; place-items: center; box-shadow: var(--shadow-md); backdrop-filter: blur(6px); cursor: pointer; }
.sheet-fab:active { transform: scale(.94); }
.sheet-fab.back { left: 14px; }
.sheet-fab.wish { right: 14px; }
.sheet-fab.wish.on { color: var(--rose); }
.hero-btn.wish { top: 12px; left: 12px; }
.hero-btn.wish.on { color: var(--rose); }
.hero .photo-actions { position: absolute; right: 12px; bottom: 12px; z-index: 3; display: flex; gap: 8px; }
.photo-btn { border: none; border-radius: 999px; padding: 8px 14px; font-weight: 700; font-size: 12.5px; background: rgba(255,255,255,0.94); color: var(--ink); box-shadow: var(--shadow-sm); backdrop-filter: blur(6px); display: inline-flex; align-items: center; gap: 6px; }
.photo-btn.danger { color: var(--rose); }

/* ---------- Image lightbox (tap a photo to see it up close) ---------- */
.lightbox { position: fixed; inset: 0; z-index: 90; background: rgba(2,20,28,0.94); display: flex; align-items: center; justify-content: center; overflow: auto; -webkit-overflow-scrolling: touch; opacity: 0; transition: opacity .18s ease; padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); }
.lightbox.open { opacity: 1; }
.lb-img { max-width: 100%; max-height: 100vh; object-fit: contain; margin: auto; display: block; cursor: zoom-in; transition: transform .2s ease; touch-action: pan-x pan-y; }
.lb-img.zoom { max-width: none; max-height: none; width: 200%; height: auto; cursor: zoom-out; }
.lb-close { position: fixed; top: calc(12px + env(safe-area-inset-top)); right: 14px; z-index: 2; width: 42px; height: 42px; border: none; border-radius: 999px; background: rgba(255,255,255,0.16); color: #fff; display: grid; place-items: center; backdrop-filter: blur(6px); cursor: pointer; }
.lb-hint { position: fixed; left: 0; right: 0; bottom: calc(16px + env(safe-area-inset-bottom)); text-align: center; color: rgba(255,255,255,0.7); font-size: 12.5px; font-weight: 600; pointer-events: none; }

/* ---------- Product-detail header (category + title, product-page style) ---------- */
.product-head { padding: 2px 2px 4px; }
.product-meta { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 3px; }
.product-cat { font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.product-date { font-size: 12.5px; font-weight: 600; color: var(--ink-faint); white-space: nowrap; }
.product-title { font-family: var(--serif); font-weight: 700; font-size: 26px; line-height: 1.12; letter-spacing: -0.02em; margin: 0; color: var(--ink); }

/* ---------- Photo gallery / thumbnail carousel (personal photos per print) ---------- */
.gallery-wrap { margin: 6px 0 14px; }
.gallery-head { font-size: 12.5px; font-weight: 700; color: var(--ink-soft); text-transform: none; margin: 0 0 8px; }
.gallery { display: flex; gap: 10px; overflow-x: auto; padding: 12px; -webkit-overflow-scrolling: touch; background: var(--surface); border: none; border-radius: 18px; box-shadow: var(--shadow-sm); }
.gtile { position: relative; flex: 0 0 auto; width: 66px; height: 66px; border-radius: 14px; overflow: hidden; border: 2px solid var(--line); background: var(--surface-2); padding: 0; cursor: pointer; }
.gtile.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.gtile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gtile .gsel { position: absolute; inset: 0; border: none; padding: 0; background: none; cursor: pointer; width: 100%; height: 100%; }
.gtile .gsel img { width: 100%; height: 100%; object-fit: cover; }
.gtile .gph { width: 100%; height: 100%; display: grid; place-items: center; color: var(--ink-faint); }
.gtile .glabel { position: absolute; left: 0; right: 0; bottom: 0; font-size: 9.5px; font-weight: 700; text-align: center; color: #fff; background: rgba(0,0,0,0.42); padding: 2px 0; }
.gtile .gdel { position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border: none; border-radius: 999px; background: rgba(0,0,0,0.55); color: #fff; display: grid; place-items: center; cursor: pointer; padding: 0; }
.gtile.gadd { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border-style: dashed; color: var(--ink-soft); background: var(--surface); }
.gtile.gadd .glabel { position: static; color: var(--ink-soft); background: none; font-size: 10.5px; padding: 0; }

.sheet-inner { padding: 16px 18px 4px; }
.sheet-title { font-family: var(--serif); font-weight: 600; font-size: 24px; line-height: 1.1; letter-spacing: -0.02em; margin: 2px 0 4px; }
.sheet-sub { color: var(--ink-soft); font-size: 13px; font-style: italic; }
.listing-price { font-size: 24px; font-weight: 800; color: var(--accent-deep); margin: 12px 0 6px; }
.listing-cond { display: flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 600; color: var(--ink-soft); margin-bottom: 8px; }
.listing-seller { display: flex; align-items: center; gap: 9px; font-size: 14px; font-weight: 600; color: var(--ink-soft); margin-bottom: 10px; }
.forsale-warn { display: flex; align-items: center; gap: 6px; margin-top: 10px; padding: 8px 11px; border-radius: 10px; background: rgba(210,120,30,0.10); color: #a2571a; font-size: 12.5px; font-weight: 600; }
.listing-actions { display: flex; gap: 10px; margin-top: 16px; }
.listing-thumbs { display: flex; gap: 8px; margin: 2px 0 12px; flex-wrap: wrap; }
.lthumb { width: 54px; height: 54px; border-radius: 10px; overflow: hidden; border: 2px solid var(--line); padding: 0; background: #fcfbf9; cursor: pointer; flex: none; }
.lthumb.on { border-color: var(--accent); }
.lthumb img { width: 100%; height: 100%; object-fit: cover; }

/* top bar messages button */
.top-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn { position: relative; width: 42px; height: 42px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); display: grid; place-items: center; flex: none; }
.icon-btn.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); }
.icon-btn .dot { position: absolute; top: 8px; right: 9px; width: 8px; height: 8px; border-radius: 999px; background: var(--accent); border: 2px solid var(--surface); }

/* conversation view */
.conv-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.back-btn { width: 38px; height: 38px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; flex: none; }
.conv-title { font-family: var(--serif); font-size: 20px; font-weight: 600; line-height: 1.1; }
.conv-sub { color: var(--ink-soft); font-size: 12.5px; font-style: italic; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread { display: flex; flex-direction: column; gap: 8px; min-height: 200px; max-height: 56vh; overflow-y: auto; padding: 4px 2px 10px; }
.msg { align-self: flex-start; max-width: 78%; padding: 9px 13px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); font-size: 14px; line-height: 1.35; }
.msg.mine { align-self: flex-end; background: var(--accent); color: #fff; border-color: transparent; }
.msg.offer { display: flex; flex-direction: column; gap: 4px; background: var(--surface-2); }
.msg.offer.mine { background: var(--accent-soft); color: var(--ink); }
.offer-amt { font-weight: 800; font-size: 16px; }
.offer-status { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--ink-faint); }
.offer-status.s-accepted { color: #2e7d47; }
.offer-status.s-declined { color: #b23b3b; }
.offer-actions { display: flex; gap: 8px; margin-top: 4px; }
.composer { display: flex; gap: 8px; align-items: center; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.composer .inp { flex: 1; margin: 0; }
.composer .btn { flex: none; padding: 10px 14px; }
.wish-forsale { display: inline-flex; align-items: center; gap: 5px; margin-top: 8px; padding: 5px 10px; border-radius: 999px; border: none; background: var(--accent-soft); color: var(--accent-ink); font-size: 12px; font-weight: 700; cursor: pointer; }

/* Market grid — image-forward cards (Depop/Vinted style) */
.market-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (min-width: 720px) { .market-grid { grid-template-columns: repeat(3, 1fr); gap: 16px; } }
@media (min-width: 1100px) { .market-grid { grid-template-columns: repeat(4, 1fr); } }
.mcard { display: flex; flex-direction: column; padding: 0; text-align: left; background: var(--surface); border: none; border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-sm); cursor: pointer; transition: transform .14s, box-shadow .14s; }
.mcard:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.mcard-photo { position: relative; aspect-ratio: 1/1; background: #fcfbf9; display: grid; place-items: center; overflow: hidden; }
.mcard-photo img { width: 100%; height: 100%; object-fit: cover; }
.mcard-photo .ph { color: var(--ink-faint); }
.mcard-price { position: absolute; left: 8px; bottom: 8px; background: rgba(28,26,24,0.82); color: #fff; font-size: 13px; font-weight: 800; padding: 4px 9px; border-radius: 999px; backdrop-filter: blur(4px); }
.mcard-body { padding: 9px 11px 12px; display: flex; flex-direction: column; gap: 2px; }
.mcard-name { font-weight: 700; font-size: 14px; color: var(--ink); line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mcard-sub { font-size: 12px; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mcard-seller { display: flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 11.5px; font-weight: 600; color: var(--ink-faint); overflow: hidden; }
.mcard-seller span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mono-sm { width: 20px; height: 20px; border-radius: 999px; display: grid; place-items: center; color: #fff; font-size: 10px; font-weight: 800; flex: none; }

/* chat: item thumbnail + labeled offer button */
.conv-thumb { width: 42px; height: 42px; border-radius: 11px; object-fit: cover; flex: none; background: #fcfbf9; }
.conv-thumb.ph { display: grid; place-items: center; color: var(--ink-faint); }
.composer .offer-btn { flex: none; gap: 5px; font-size: 13.5px; padding: 10px 13px; }
.composer .send-btn { flex: none; }
.offer-input { text-align: center; font-size: 22px; font-weight: 800; padding: 14px; }

/* Profile & settings — a tidy, narrow centered column instead of full-width forms */
.settings { max-width: 520px; margin: 8px auto 0; }
.settings .formwrap { border-style: solid; border-color: var(--line); margin-top: 12px; }
.settings .section-title { margin-top: 6px; }
.settings .inp { margin-top: 0; }
.acct-row { display: flex; align-items: center; gap: 11px; }
.reset-link { display: block; width: 100%; text-align: center; background: none; border: none; box-shadow: none; color: var(--ink-faint); font-size: 13px; font-weight: 700; padding: 10px; cursor: pointer; }
.reset-link:hover { color: var(--sold); }

/* Closet at-a-glance summary — one clean band, not separate boxes */
.closet-summary { display: flex; gap: 10px; margin-bottom: 16px; }
.cstat { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 13px 13px; border-radius: 16px; box-shadow: var(--shadow-sm); }
.cstat.yellow { background: var(--c-yellow); color: var(--c-yellow-ink); }
.cstat.pink { background: var(--c-pink); color: var(--c-pink-ink); }
.cstat.olive { background: var(--c-olive); color: var(--c-olive-ink); }
.cstat.blue { background: var(--c-blue); color: var(--c-blue-ink); }
.cs-num { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; line-height: 1; }
.cs-lab { font-size: 10.5px; font-weight: 650; opacity: .68; white-space: nowrap; }
.listing-soon { display: flex; align-items: center; gap: 8px; margin-top: 14px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); color: var(--ink-soft); font-size: 13px; font-weight: 600; }

.sec-head { display: flex; align-items: center; margin: 22px 2px 12px; }
.sec-head h3 { font-size: 15.5px; font-weight: 800; }
.sec-head .count { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--accent-ink); background: var(--accent-soft); padding: 3px 11px; border-radius: 999px; }
button.sec-head.add-toggle { width: 100%; border: none; background: var(--surface); box-shadow: var(--shadow-sm); border-radius: 14px; padding: 12px 15px; margin: 18px 0 12px; cursor: pointer; text-align: left; }
button.sec-head.add-toggle h3 { color: var(--ink); }
button.sec-head.add-toggle .icon { margin-left: auto; color: var(--ink-faint); transition: transform .2s ease; }
button.sec-head.add-toggle.open .icon { transform: rotate(90deg); }
button.sec-head.add-toggle.open { background: var(--accent-soft); box-shadow: none; }
button.sec-head.add-toggle.open h3 { color: var(--accent-ink); }

/* owned piece cards */
.pieces { display: flex; flex-direction: column; gap: 11px; }
.piece { background: var(--surface); border: none; border-radius: 18px; padding: 14px 15px; box-shadow: var(--shadow-sm); }
.piece .prow { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: none; border: none; padding: 0; }
.pbadge { flex: none; width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; }
.pbadge.pb-olive { background: var(--c-olive); color: #fff; }
.pbadge.pb-yellow { background: var(--c-yellow); color: var(--c-yellow-ink); }
.pbadge.pb-blue { background: var(--c-blue); color: var(--c-blue-ink); }
.pbadge.pb-pink { background: var(--c-pink); color: var(--c-pink-ink); }
.piece .pi { flex: 1; min-width: 0; }
.piece .nm { font-weight: 800; font-size: 15px; }
.piece .meta { margin-top: 6px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.tagp { display: inline-flex; align-items: center; line-height: 1; font-size: 12px; font-weight: 700; padding: 6px 11px; border-radius: 999px; background: var(--surface-2); color: var(--ink-soft); }
.tagp.have { background: var(--accent-soft); color: var(--accent-ink); }
.tagp.sold { background: var(--sold-soft); color: var(--sold); text-decoration: line-through; }
.tagp.incoming { background: var(--incoming-soft); color: var(--incoming); }
.tagp.price { background: var(--money-soft); color: var(--money); }
.tagp.gift { background: var(--rose-soft); color: var(--rose); }
.piece .note { font-size: 12.5px; color: var(--ink-soft); font-style: italic; margin-top: 7px; }
.piece .chev { color: var(--ink-faint); flex: none; margin-top: 1px; }

/* editor (edit an existing piece, expanded under its card) */
.editor { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }

/* add-piece form */
.formwrap { background: var(--surface); border: 1px dashed var(--accent-line); border-radius: 20px; padding: 18px; box-shadow: var(--shadow-sm); }
.formwrap .fh { font-weight: 800; font-size: 15px; }
.formwrap .fhint { color: var(--ink-soft); font-size: 12.5px; margin: 4px 0 14px; line-height: 1.45; }
.f { margin-bottom: 14px; }
.f > label { display: block; font-size: 12px; font-weight: 700; color: var(--ink-soft); margin-bottom: 7px; }
.f2 { display: flex; gap: 11px; }
.f2 .f { flex: 1; }
.pick { display: flex; flex-wrap: wrap; gap: 7px; }
.pk { border: 1.5px solid var(--line-strong); background: var(--surface); border-radius: 11px; padding: 9px 13px; font-weight: 700; font-size: 13px; color: var(--ink-soft); }
.pk.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.stepper { display: flex; align-items: center; gap: 14px; }
.stepper .stbtn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border: 1.5px solid var(--line-strong); background: var(--surface); border-radius: 12px; color: var(--ink); }
.stepper .stbtn:disabled { opacity: .4; }
.stepper .qval { min-width: 30px; text-align: center; font-weight: 800; font-size: 18px; color: var(--ink); }
.collapse { border: none; border-radius: 17px; margin-bottom: 10px; background: var(--surface); overflow: hidden; box-shadow: var(--shadow-sm); }
.collapse-head { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 13px 15px; background: none; border: none; cursor: pointer; font-weight: 700; font-size: 14.5px; color: var(--ink); }
.collapse-head .icon { color: var(--ink-soft); display: inline-flex; }
.collapse-head .icon svg { transition: transform .18s; }
.collapse-head.open .icon svg { transform: rotate(90deg); }
.collapse-body { display: none; }
.collapse-body.open { display: block; padding: 0 15px 10px; }
.breakdown { margin-bottom: 6px; }
.bd-row { display: flex; align-items: center; gap: 12px; padding: 6px 0; }
.bd-label { width: 36%; font-weight: 700; font-size: 13.5px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bd-track { flex: 1; height: 10px; background: var(--surface-2); border-radius: 6px; overflow: hidden; }
.bd-fill { height: 100%; background: var(--accent); border-radius: 6px; min-width: 6px; }
.bd-row:nth-child(4n+1) .bd-fill { background: var(--c-yellow-deep); }
.bd-row:nth-child(4n+2) .bd-fill { background: var(--c-pink-deep); }
.bd-row:nth-child(4n+3) .bd-fill { background: var(--c-olive); }
.bd-row:nth-child(4n+4) .bd-fill { background: var(--c-blue-deep); }
.bd-num { width: 30px; text-align: right; font-weight: 800; font-size: 13.5px; color: var(--ink-soft); }
.inp { width: 100%; border: 1.5px solid var(--line-strong); border-radius: 14px; padding: 12px 14px; background: #fff; outline: none; }
.inp:focus { border-color: var(--accent-line); }
textarea.inp { resize: vertical; min-height: 42px; }
.seg { display: flex; background: var(--surface-2); border-radius: 11px; padding: 3px; gap: 3px; }
.seg button { flex: 1; border: none; background: transparent; border-radius: 9px; padding: 9px; font-weight: 780; font-size: 13px; color: var(--ink-soft); }
.seg button.on-have { background: var(--accent); color: #fff; }
.seg button.on-sold { background: var(--sold); color: #fff; }
.seg button.on-incoming { background: var(--incoming); color: #fff; }
.seg button.on-wish { background: var(--rose); color: #fff; }
.seg.seg4 button { font-size: 12px; padding: 9px 4px; }
.chk { display: flex; align-items: center; gap: 9px; margin: 12px 0 2px; font-weight: 600; font-size: 14px; color: var(--ink); cursor: pointer; }
.chk input { width: 19px; height: 19px; accent-color: var(--accent); flex: none; }

.btn { border: none; border-radius: 13px; padding: 11px 17px; font-weight: 750; font-size: 14.5px; background: var(--accent); color: #fff; box-shadow: var(--shadow-sm); display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn:active { transform: scale(.97); }
.btn.block { width: 100%; }
.btn.dark { background: var(--accent); }
.btn.soft { background: var(--surface-2); color: var(--ink); box-shadow: none; }
.btn.ghost { background: transparent; color: var(--accent-ink); box-shadow: none; padding-left: 2px; }
.btn.danger-ghost { background: transparent; color: var(--rose); box-shadow: none; }
.btn[disabled] { opacity: .45; }

/* friends */
.friend-list { display: flex; flex-direction: column; gap: 10px; }
.friend { display: flex; align-items: center; gap: 13px; background: var(--surface); border: none; border-radius: 18px; padding: 13px 15px; box-shadow: var(--shadow-sm); width: 100%; text-align: left; }
.friend .mono-lg { width: 46px; height: 46px; border-radius: 999px; display: grid; place-items: center; color: #fff; font-weight: 780; font-size: 16px; flex: none; }
.friend .fn { font-weight: 800; font-size: 15.5px; }
.friend .fmeta { color: var(--ink-soft); font-size: 12.5px; font-weight: 550; margin-top: 1px; }
.friend .arrow { margin-left: auto; color: var(--ink-faint); }
.friend .thumb-mini { width: 46px; height: 46px; border-radius: 12px; overflow: hidden; background: #fcfbf9; flex: none; display: grid; place-items: center; }
.friend .thumb-mini img { width: 100%; height: 100%; object-fit: contain; }

.banner { position: relative; overflow: hidden; background: var(--c-blue-soft); border: none; border-radius: var(--r-lg); padding: 17px 18px; margin-bottom: 16px; box-shadow: var(--shadow-sm); }
.banner h2 { margin: 0 0 5px; font-family: var(--serif); font-weight: 700; font-size: 18px; letter-spacing: -0.02em; color: var(--c-blue-ink); position: relative; z-index: 1; }
.banner p { margin: 0; font-size: 13px; color: var(--c-blue-ink); opacity: .72; font-weight: 550; line-height: 1.45; position: relative; z-index: 1; }
.banner::before { content: ""; position: absolute; top: -30px; right: -26px; width: 110px; height: 110px; border-radius: 999px; background: var(--c-blue); opacity: .5; }
.compare-toggle { display: flex; gap: 8px; margin: 2px 0 16px; }

.empty { text-align: center; color: var(--ink-soft); padding: 46px 22px; font-weight: 550; }
.empty-line { color: var(--ink-soft); font-size: 13.5px; font-weight: 550; padding: 2px 2px 4px; }
.empty > .icon { color: var(--c-olive-ink); background: var(--c-olive-soft); width: 66px; height: 66px; border-radius: 999px; display: grid; place-items: center; margin: 0 auto 14px; }
.section-title { font-size: 15px; font-weight: 800; margin: 22px 2px 11px; display: flex; align-items: center; gap: 9px; }
.section-title::before { content: ""; width: 14px; height: 14px; border-radius: 5px; background: var(--c-yellow-deep); flex: none; }
.section-title .pill { font-size: 11px; background: var(--surface-2); color: var(--ink-soft); padding: 2px 9px; border-radius: 999px; font-weight: 700; }
.spacer { height: 8px; }

/* ---------- For-sale tag + editor controls ---------- */
.tagp.forsale { background: var(--accent); color: #fff; }
.forsale { margin-top: 6px; }
.market-row { display: flex; flex-wrap: wrap; gap: 7px; }
.market { border: 1.5px solid var(--line-strong); background: var(--surface); border-radius: 999px; padding: 7px 13px; font-weight: 700; font-size: 13px; color: var(--ink-soft); cursor: pointer; }
.market.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
.btn.sm { padding: 9px 13px; font-size: 13.5px; border-radius: 11px; }

/* ---------- Selling + Wishlist lists ---------- */
.sell-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 6px; }
.sell-card { display: flex; align-items: center; gap: 13px; background: var(--surface); border: none; border-radius: 18px; padding: 13px 15px; box-shadow: var(--shadow-sm); width: 100%; text-align: left; }
.sell-card.tap { cursor: pointer; }
.sell-card.tap:hover { border-color: var(--accent-line); }
.sell-thumb { width: 58px; height: 58px; flex: none; border-radius: 12px; object-fit: contain; background: var(--surface-2); }
.sell-thumb.ph { display: flex; align-items: center; justify-content: center; color: var(--ink-faint); }
.sell-body { flex: 1; min-width: 0; }
.sell-name { font-family: var(--serif); font-weight: 600; font-size: 15.5px; letter-spacing: -0.01em; color: var(--ink); }
.sell-sub { font-size: 12.5px; font-weight: 650; color: var(--ink-soft); margin-top: 1px; }
.sell-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-top: 7px; font-size: 12.5px; font-weight: 650; }
.sell-meta .ask { color: var(--money); font-weight: 780; }
.sell-meta .posted { display: inline-flex; align-items: center; gap: 4px; color: var(--ink-soft); }
.sell-meta .posted.muted { color: var(--ink-faint); }
.sell-meta .sold-amt { color: var(--sold); font-weight: 780; }
.sell-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 11px; }
.sell-actions .btn { flex: 1 1 auto; }
.wish-sizes { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 8px; }
.wchip { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-2); color: var(--ink); font-weight: 700; font-size: 12.5px; padding: 5px 6px 5px 11px; border-radius: 999px; }
.wx { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border: none; border-radius: 999px; background: #fff; color: var(--ink-soft); cursor: pointer; }
.wx:hover { color: var(--rose); }

/* ---------- Scan modal ---------- */
.scan-scrim { position: fixed; inset: 0; background: rgba(20,20,28,0.45); opacity: 0; transition: opacity .24s; z-index: 60; }
.scan-scrim.open { opacity: 1; }
.scan-modal { position: fixed; left: 50%; top: 50%; z-index: 61; width: min(440px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow-y: auto; background: var(--surface); border-radius: 22px; box-shadow: var(--shadow-md); padding: 18px 18px 20px; transform: translate(-50%, -46%) scale(.96); opacity: 0; transition: opacity .24s, transform .24s; }
.scan-modal.open { transform: translate(-50%, -50%) scale(1); opacity: 1; }
.scan-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.scan-head h3 { margin: 0; font-family: var(--serif); font-weight: 600; font-size: 18px; }
.scan-x { border: none; background: var(--surface-2); color: var(--ink-soft); width: 34px; height: 34px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.scan-tip { margin: 0 0 14px; font-size: 13.5px; color: var(--ink-soft); font-weight: 550; line-height: 1.45; }
.scan-fine { margin: 12px 0 0; font-size: 12px; color: var(--ink-faint); font-weight: 550; }
.scan-preview { width: 100%; max-height: 220px; object-fit: contain; border-radius: 14px; background: var(--surface-2); margin-bottom: 14px; }
.scan-loading { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 18px 0 8px; color: var(--ink-soft); font-weight: 650; }
.spin { width: 34px; height: 34px; border-radius: 999px; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.scan-err { background: var(--rose-soft); color: var(--rose); border-radius: 12px; padding: 13px 15px; font-size: 13.5px; font-weight: 600; margin-bottom: 14px; }

@media (min-width: 720px) {
  .nav { display: none; }
  .tabs-desktop { display: flex; }
  .app-shell { padding-bottom: 44px; }
  .grid { grid-template-columns: repeat(4, 1fr); gap: 18px; }
  .controls { flex-direction: row; align-items: center; }
  .search { flex: 1; }
  .sheet {
    left: 50%; right: auto; top: 50%; bottom: auto;
    width: min(1060px, 95vw); height: 86vh; max-height: 880px; max-width: none;
    display: flex; flex-direction: row; overflow: hidden; padding: 0;
    transform: translate(-50%, -46%) scale(.97); opacity: 0; border-radius: 22px;
  }
  .sheet.open { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  .hero { flex: 0 0 47%; height: 100%; max-height: none; aspect-ratio: auto; border-radius: 22px 0 0 22px; }
  .hero .grip { display: none; }
  .sheet-inner { flex: 1 1 53%; height: 100%; overflow-y: auto; padding: 30px 30px 34px; }
  .hero-btn.close { display: grid; position: absolute; top: 12px; right: 12px; margin: 0; align-self: auto; z-index: 5; }
  .hero-btn.wish { display: grid; }
  .sheet-close-fab, .sheet-fab { display: none; }
  .brand small { display: inline; }
  .avatar-btn { max-width: none; }
  .f2 { gap: 11px; }
}

@media (min-width: 1100px) {
  .grid { grid-template-columns: repeat(5, 1fr); }
}

/* ============================================================
   SUBSCRIPTION / PAYWALL
   ============================================================ */
/* Trial countdown bar under the tabs */
.trial-bar {
  display: flex; align-items: center; gap: 10px; width: 100%;
  margin: 4px 0 14px; padding: 11px 16px;
  border: none; cursor: pointer; text-align: left;
  border-radius: var(--r-md);
  background: var(--accent-soft); color: var(--accent-ink);
  font-family: var(--font); font-size: 14px; font-weight: 600;
  box-shadow: var(--shadow-sm);
}
.trial-bar svg { flex: 0 0 auto; }
.trial-bar .tb-text { flex: 1; min-width: 0; }
.trial-bar .tb-cta {
  flex: 0 0 auto; background: var(--accent); color: #fff;
  padding: 6px 14px; border-radius: 999px; font-weight: 700; font-size: 13px;
}

/* Full-screen paywall (trial expired) */
.paywall {
  min-height: 100vh; min-height: 100dvh;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 18px 60px; background: var(--bg);
}
.pw-card {
  width: 100%; max-width: 440px;
  background: var(--surface); border-radius: var(--r-xl);
  box-shadow: var(--shadow-md); padding: 26px 22px 24px;
}
.pw-head { text-align: center; margin-bottom: 20px; }
.pw-title { font-size: 22px; font-weight: 800; color: var(--ink); margin: 12px 0 6px; }
.pw-sub { font-size: 14px; color: var(--ink-soft); line-height: 1.45; }

/* Plan cards (shared by paywall, Subscribe view) */
.plan-wrap { display: block; }
.plan-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.plan-card {
  position: relative; background: var(--surface); border: 2px solid var(--line-strong);
  border-radius: var(--r-lg); padding: 18px 14px 16px; text-align: center;
  display: flex; flex-direction: column; gap: 8px;
}
.plan-card.feat { border-color: var(--accent); background: var(--accent-soft); }
.plan-name { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); }
.plan-card.feat .plan-name { color: var(--accent-ink); }
.plan-price { display: flex; align-items: baseline; justify-content: center; gap: 4px; flex-wrap: wrap; }
.plan-price .pp-amt { font-size: 26px; font-weight: 800; color: var(--ink); }
.plan-price .pp-per { font-size: 13px; color: var(--ink-soft); }
.plan-note {
  display: inline-block; align-self: center; background: var(--accent); color: #fff;
  font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 999px;
}
.plan-card .btn { margin-top: auto; }
.plan-perks { list-style: none; margin: 18px 0 4px; padding: 0; display: grid; gap: 10px; }
.plan-perks li { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--ink); }
.plan-perks li svg { flex: 0 0 auto; color: var(--money); }

/* Locked-market card (shown to trial / expired users on the Market tab) */
.market-lock {
  background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--shadow-sm);
  padding: 30px 22px; text-align: center; margin-top: 6px;
}
.market-lock .ml-badge {
  width: 62px; height: 62px; margin: 0 auto 14px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent-ink);
}
.market-lock .ml-title { font-size: 17px; font-weight: 800; color: var(--ink); margin-bottom: 6px; }
.market-lock .ml-sub { font-size: 14px; color: var(--ink-soft); line-height: 1.45; max-width: 320px; margin: 0 auto; }

/* Subscription card on the Dashboard */
.sub-badge {
  width: 40px; height: 40px; flex: 0 0 auto; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--money-soft); color: var(--money);
}

@media (min-width: 720px) {
  .plan-grid { max-width: 460px; }
}

/* Brand logo lockup (replaces the old text wordmark) */
.brand-logo { height: 28px; width: auto; display: block; }
@media (min-width: 720px) { .brand-logo { height: 34px; } }
.auth-logo { display: block; width: 240px; max-width: 78%; height: auto; margin: 2px auto 16px; }
