/* Project E Phase 4 — mobile responsive overrides.
   All rules guarded by @media (max-width: 768px) unless noted.
   Tokens reference static/colors_and_type.css. */

.mobile-tabbar { display: none; }

@media (max-width: 768px) {
  .mobile-tabbar {
    position: fixed; bottom: 0; left: 0; right: 0;
    height: calc(64px + env(safe-area-inset-bottom));
    padding: 10px 16px env(safe-area-inset-bottom);
    background: rgba(10, 28, 18, 0.96);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1.5px solid rgba(245, 236, 212, 0.10);
    display: flex; justify-content: space-around; align-items: flex-start;
    z-index: 100;
  }
  .mobile-tabbar .tab {
    display: flex; flex-direction: column; align-items: center;
    gap: 4px; padding: 4px 10px; cursor: pointer; text-decoration: none;
    color: #5F7062; position: relative;
  }
  .mobile-tabbar .tab svg {
    width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8;
  }
  .mobile-tabbar .tab .lbl {
    font-family: 'DM Mono', monospace;
    font-size: 8px; letter-spacing: 0.14em; text-transform: uppercase;
  }
  .mobile-tabbar .tab.active { color: var(--rust-500, #c8541e); }
  .mobile-tabbar .badge {
    position: absolute; top: -2px; right: 4px;
    min-width: 16px; height: 16px; padding: 0 4px;
    border-radius: 8px; background: var(--rust-500, #c8541e);
    color: #fff; font-family: 'DM Mono', monospace;
    font-size: 9px; line-height: 16px; text-align: center;
  }

  body.has-mobile-tabbar {
    padding-bottom: calc(84px + env(safe-area-inset-bottom));
  }

  .desktop-only { display: none !important; }

  /* ── Page / sheet surfaces ─────────────────────────────────────── */

  /* Main portal page background */
  .portal-page-bg {
    background: var(--p-bg);
    color: var(--p-text);
  }

  /* ── Stat-hero (non-rust variant) ───────────────────────────────── */
  .stat-hero {
    background: var(--p-thead);
    border-bottom: 1px solid var(--p-border);
  }
  .stat-hero .hero-label {
    color: var(--p-text-muted);
    font-size: 11px; letter-spacing: 0.09em; text-transform: uppercase;
  }
  .stat-hero .hero-value {
    color: var(--p-text);
  }

  /* rust variant keeps its own cream-on-rust colours — leave hardcoded */
  .stat-hero.rust {
    background: var(--rust-700, #7a2e10);
  }
  .stat-hero.rust .hero-label { color: #F5ECD4; }
  .stat-hero.rust .hero-value { color: #F5ECD4; }

  /* ── Card-detail bottom sheet ────────────────────────────────────── */
  .card-detail-sheet .detail-backdrop {
    /* translucent dark overlay — theme-invariant */
    background: rgba(7, 17, 10, 0.55);
  }
  .card-detail-sheet .detail-sheet {
    background: var(--p-bg);
    border-top: 1px solid var(--p-border);
    color: var(--p-text);
  }
  .card-detail-sheet .detail-bid {
    background: var(--p-thead);
    border-bottom: 1px solid var(--p-border);
  }
  .card-detail-sheet .detail-title {
    color: var(--p-text);
  }
  .card-detail-sheet .detail-stats .v {
    color: var(--p-text);
  }
  .card-detail-sheet .detail-stats .k {
    color: var(--p-text-muted);
  }
  /* card-frame inside sheet — cream trading-card aesthetic, both themes */
  .card-detail-sheet .card-frame {
    background: #FBF5DF;
  }

  /* ── Tile (trading-card frame) — cream in BOTH themes ──────────── */
  .tile {
    background: #FBF5DF;
    border-radius: 10px;
  }
  /* badge on tile — cream-on-rust, always cream */
  .tile .badge {
    background: var(--rust-500, #c8541e);
    color: #F5ECD4;
  }
  /* pending-stub label on tile — cream-on-rust */
  .tile .pending-stub {
    color: #F5ECD4;
  }

  /* ── Stack card (carousel) — cream trading-card, both themes ────── */
  .stack-card {
    background: #FBF5DF;
    border-radius: 10px;
    border: 1px solid var(--p-border);
  }

  /* ── Inbox list rows ────────────────────────────────────────────── */
  .inbox-row {
    background: var(--p-thead);
    border-bottom: 1px solid var(--p-border);
  }
  .inbox-title {
    color: var(--p-text);
  }
  .inbox-meta {
    color: var(--p-text-muted);
  }
  .inbox-timestamp {
    color: var(--p-text-faint);
  }

  /* ── Empty states ──────────────────────────────────────────────── */
  .empty-state {
    background: var(--p-thead);
    border: 1px solid var(--p-border);
    border-radius: 12px;
  }
  .empty-heading {
    color: var(--p-text);
  }
  .empty-body {
    color: var(--p-text-muted);
  }

  /* ── Sales table rows ──────────────────────────────────────────── */
  .sales-table tr:nth-child(even) td,
  .sales-row-alt {
    background: var(--p-thead);
  }
  .sales-table td,
  .sales-table th {
    border-bottom: 1px solid var(--p-border);
    color: var(--p-text);
  }
  .sales-table th {
    color: var(--p-text-muted);
  }

  /* ── eBay CTA banner — cream-on-rust, always cream ─────────────── */
  .ebay-cta {
    background: var(--rust-600, #92380e);
    color: #F5ECD4;
  }
  .ebay-cta .cta-sub {
    color: #F5ECD4;
    opacity: 0.80;
  }
}

@media (min-width: 769px) {
  .mobile-only { display: none !important; }
}

/* ── Card detail sheet (mobile = slide-up, desktop = centered modal) ── */
.card-detail-sheet { display: none; }
.card-detail-sheet.open { display: block; }

.card-detail-sheet .detail-backdrop {
  position: fixed; inset: 0;
  backdrop-filter: blur(8px);
  z-index: 200;
}

.card-detail-sheet .detail-sheet {
  position: fixed;
  overflow: hidden; display: flex; flex-direction: column;
  z-index: 201; box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.6);
}

@media (max-width: 768px) {
  .card-detail-sheet .detail-sheet {
    left: 0; right: 0; bottom: 0; top: 60px;
    border-radius: 32px 32px 0 0;
    animation: sawtoothSheetSlideUp 0.35s cubic-bezier(0.2, 0.7, 0.1, 1) both;
  }
}
@media (min-width: 769px) {
  .card-detail-sheet .detail-backdrop {
    background: rgba(7, 17, 10, 0.55);
  }
  .card-detail-sheet .detail-sheet {
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    background: #0E2418; color: #F5ECD4;
    width: 480px; max-height: 80vh; border-radius: 16px;
    animation: sawtoothSheetFadeIn 0.25s ease both;
  }
}

@keyframes sawtoothSheetSlideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes sawtoothSheetFadeIn  { from { opacity: 0; } to { opacity: 1; } }

.card-detail-sheet .detail-handle {
  width: 44px; height: 5px; background: rgba(245, 236, 212, 0.32);
  border-radius: 3px; margin: 10px auto;
}
.card-detail-sheet .detail-topbar {
  display: flex; justify-content: space-between; align-items: center; padding: 6px 22px;
}
.card-detail-sheet .detail-status {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: 'Alfa Slab One', serif; font-size: 10px; letter-spacing: 0.14em;
  padding: 5px 11px; border-radius: 999px; text-transform: uppercase; color: #fff;
}
.card-detail-sheet .detail-status.live { background: #2D5233; border: 1px solid #1B3D2A; }
.card-detail-sheet .detail-status.sold { background: var(--rust-600, #b04d1a); border: 1px solid var(--rust-700, #8b3617); }
.card-detail-sheet .detail-close {
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(245, 236, 212, 0.08);
  border: 1px solid rgba(245, 236, 212, 0.18);
  color: #F5ECD4; font-size: 14px; cursor: pointer;
}
.card-detail-sheet .detail-body { flex: 1; overflow-y: auto; padding: 6px 22px 28px; }
.card-detail-sheet .detail-hero { margin: 8px 0 16px; display: flex; justify-content: center; }
.card-detail-sheet .detail-hero .card-frame {
  width: 200px; aspect-ratio: 5/7; padding: 8px;
  border-radius: 14px;
  box-shadow: 0 0 0 1.5px #0E2418, 0 16px 36px rgba(0, 0, 0, 0.55);
}
.card-detail-sheet .detail-hero .card-frame .inside {
  width: 100%; height: 100%; border-radius: 7px;
  background: radial-gradient(ellipse at 50% 45%, #2D5233, #1B3D2A 55%, #0E2418 100%);
  border: 1.5px solid #0E2418;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.card-detail-sheet .detail-hero .card-frame .inside img { width: 100%; height: 100%; object-fit: cover; }
.card-detail-sheet .detail-title {
  font-family: 'Alfa Slab One', serif;
  font-size: 20px; letter-spacing: 0.02em;
  text-transform: uppercase; line-height: 1.1;
  margin-bottom: 6px; text-align: center;
}
.card-detail-sheet .detail-tags {
  font-family: 'DM Mono', monospace;
  font-size: 10px; letter-spacing: 0.16em;
  text-transform: uppercase; color: #8FA98E;
  text-align: center; margin-bottom: 18px;
}
.card-detail-sheet .detail-bid {
  border-radius: 18px; padding: 18px 20px; margin-bottom: 14px;
}
.card-detail-sheet .detail-bid .lbl {
  font-family: 'DM Mono', monospace;
  font-size: 10px; letter-spacing: 0.2em;
  text-transform: uppercase; color: #8FA98E;
  margin-bottom: 4px; display: flex; align-items: center; gap: 6px;
}
.card-detail-sheet .detail-bid .amt {
  font-family: 'Big Shoulders Display', sans-serif;
  font-weight: 900; font-size: 54px; line-height: 0.9;
  letter-spacing: -0.02em; color: var(--rust-500, #c8541e);
}
.card-detail-sheet .detail-bid .meta {
  font-family: 'DM Mono', monospace;
  font-size: 10px; letter-spacing: 0.16em;
  text-transform: uppercase; color: #C9D5BD; margin-top: 6px;
}
.card-detail-sheet .pulse-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--rust-500, #c8541e);
  box-shadow: 0 0 6px var(--rust-500, #c8541e);
  animation: sawtoothPulse 1.6s ease-in-out infinite;
}
@keyframes sawtoothPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
.card-detail-sheet .detail-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  margin-top: 16px; padding-top: 14px;
  border-top: 1px dashed rgba(245, 236, 212, 0.18);
}
.card-detail-sheet .detail-stats .s { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.card-detail-sheet .detail-stats .v {
  font-family: 'Big Shoulders Display', sans-serif;
  font-weight: 800; font-size: 22px; line-height: 1;
}
.card-detail-sheet .detail-stats .l {
  font-family: 'DM Mono', monospace;
  font-size: 8px; letter-spacing: 0.16em;
  text-transform: uppercase; color: #8FA98E;
}
.card-detail-sheet .bid-section { margin-bottom: 14px; }
.card-detail-sheet .bid-section h3 {
  font-family: 'Alfa Slab One', serif;
  font-size: 12px; letter-spacing: 0.06em;
  text-transform: uppercase; color: #F5ECD4; margin-bottom: 10px;
}
.card-detail-sheet .bid-list {
  background: rgba(245, 236, 212, 0.04);
  border: 1.5px solid rgba(245, 236, 212, 0.12);
  border-radius: 14px; overflow: hidden;
}
.card-detail-sheet .bid-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px;
  border-bottom: 1px dashed rgba(245, 236, 212, 0.1);
}
.card-detail-sheet .bid-row:last-child { border-bottom: none; }
.card-detail-sheet .bid-row .who {
  font-family: 'DM Mono', monospace;
  font-size: 10px; letter-spacing: 0.12em;
  text-transform: uppercase; color: #C9D5BD;
}
.card-detail-sheet .bid-row .amt {
  font-family: 'Big Shoulders Display', sans-serif;
  font-weight: 800; font-size: 16px; color: var(--rust-500, #c8541e);
}
.card-detail-sheet .bid-row .when {
  font-family: 'DM Mono', monospace;
  font-size: 8px; letter-spacing: 0.12em;
  text-transform: uppercase; color: #5F7062;
}
.card-detail-sheet .ebay-cta {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  border: 2px solid var(--rust-700, #8b3617);
  color: #fff;
  font-family: 'Alfa Slab One', serif;
  font-size: 15px; letter-spacing: 0.06em;
  padding: 16px; border-radius: 14px;
  text-transform: uppercase; text-decoration: none;
  margin-bottom: 10px; width: 100%;
}
.card-detail-sheet .action-row { display: flex; gap: 8px; }
.card-detail-sheet .action-row button {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
  background: transparent; color: #F5ECD4;
  border: 1.5px solid rgba(245, 236, 212, 0.2);
  font-family: 'DM Mono', monospace;
  font-size: 10px; letter-spacing: 0.16em;
  padding: 13px; border-radius: 14px;
  text-transform: uppercase; cursor: pointer;
}

/* ── /portal/cards page ── */
.portal-cards-page .cards-head {
  padding: 14px 22px 8px;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.portal-cards-page .cards-head h1 {
  font-family: 'Alfa Slab One', serif;
  font-size: 26px; line-height: 1; letter-spacing: 0.01em; text-transform: uppercase;
}
.portal-cards-page .cards-head .sub {
  font-family: 'DM Mono', monospace;
  font-size: 9px; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--rust-500, #c8541e); margin-top: 4px;
}

.view-toggle {
  display: flex;
  background: rgba(245, 236, 212, 0.08);
  border: 1px solid rgba(245, 236, 212, 0.16);
  border-radius: 999px;
  padding: 4px; gap: 2px; flex-shrink: 0;
}
.view-toggle button {
  width: 38px; height: 38px; border-radius: 50%;
  background: none; border: none; color: #8FA98E;
  cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0;
}
.view-toggle button.on {
  background: var(--rust-600, #b04d1a);
  color: #fff;
  box-shadow: 0 2px 6px rgba(200, 84, 30, 0.4);
}
.view-toggle svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.8; }

.filter-row {
  padding: 6px 22px 14px;
  display: flex; gap: 8px; overflow-x: auto;
}
.filter-row::-webkit-scrollbar { display: none; }
.filter-row .pill {
  font-family: 'Alfa Slab One', serif;
  font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 10px 18px; border-radius: 999px;
  background: rgba(245, 236, 212, 0.06);
  border: 1.5px solid rgba(245, 236, 212, 0.16);
  color: #C9D5BD; white-space: nowrap; cursor: pointer;
  min-height: 42px; display: inline-flex; align-items: center;
}
.filter-row .pill.on {
  background: var(--rust-600, #b04d1a);
  color: #fff;
  border-color: var(--rust-700, #8b3617);
  box-shadow: 0 2px 8px rgba(200, 84, 30, 0.35);
}

.card-grid { padding: 0 22px 16px; display: grid; }
.card-grid.cols-1 { grid-template-columns: 1fr; gap: 16px; }
.card-grid.cols-2 { grid-template-columns: 1fr 1fr; gap: 10px; }
.card-grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; gap: 8px; }

.tile {
  background: #FBF5DF; border-radius: 12px;
  box-shadow: 0 0 0 1.5px #0E2418, 0 6px 18px rgba(0, 0, 0, 0.4);
  display: flex; flex-direction: column; cursor: pointer; overflow: hidden;
  transition: transform 0.18s, box-shadow 0.18s;
}
.tile.pending { cursor: default; }
.tile:hover, .tile:active { transform: translateY(-2px); box-shadow: 0 0 0 1.5px #0E2418, 0 10px 24px rgba(0, 0, 0, 0.55); }
.tile .art {
  aspect-ratio: 5/7;
  background: radial-gradient(ellipse at 50% 45%, #2D5233, #1B3D2A 55%, #0E2418 100%);
  position: relative; overflow: hidden;
  margin: 6px 6px 0;
  border: 1.5px solid #0E2418; border-radius: 6px;
}
.tile .art img.real { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile .badge {
  position: absolute; top: 8px; left: 8px;
  background: var(--rust-600, #b04d1a); color: #fff;
  font-family: 'Alfa Slab One', serif; letter-spacing: 0.1em;
  padding: 3px 8px; border-radius: 3px;
  text-transform: uppercase; z-index: 2;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
  font-size: 9px;
}
.tile .badge.live { background: #2D5233; border: 1px solid #1B3D2A; }
.tile .foot { padding: 8px 8px 6px; color: #0E2418; }
.tile .name {
  font-family: 'Sora', sans-serif; font-weight: 600;
  color: #0E2418; line-height: 1.25;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical;
  overflow: hidden; font-size: 11px;
}
.tile .price-row { display: flex; justify-content: space-between; align-items: baseline; margin-top: 2px; }
.tile .price {
  font-family: 'Big Shoulders Display', sans-serif;
  font-weight: 800; color: var(--rust-600, #b04d1a);
  letter-spacing: -0.005em; font-size: 18px;
}
.tile .status {
  font-family: 'DM Mono', monospace;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: #5C8A5F; font-weight: 500; font-size: 8px;
}
.tile .status.sold { color: #8B3617; }
.tile .status-dot { display: none; width: 7px; height: 7px; border-radius: 50%; }
.tile .status-dot.sold { background: var(--rust-600, #b04d1a); }
.tile .status-dot.live { background: #2D5233; }
.tile .pending-stub {
  background: var(--rust-600, #b04d1a);
  color: #FBF5DF;
  font-family: 'Alfa Slab One', serif;
  letter-spacing: 0.12em; text-transform: uppercase;
  text-align: center; border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.22), inset 0 -2px 0 var(--rust-900, #6f290d);
  border: 1.5px solid var(--rust-700, #8b3617);
  margin: 7px 6px 6px; padding: 9px; font-size: 12px;
}

.card-grid.cols-1 .tile .name { font-size: 14px; -webkit-line-clamp: 2; }
.card-grid.cols-1 .tile .price { font-size: 26px; }
.card-grid.cols-1 .tile .status { font-size: 10px; }

.card-grid.cols-3 .tile { border-radius: 8px; }
.card-grid.cols-3 .tile .badge { display: none; }
.card-grid.cols-3 .tile .foot { padding: 5px 6px 4px; }
.card-grid.cols-3 .tile .name { display: none; }
.card-grid.cols-3 .tile .price { font-size: 14px; }
.card-grid.cols-3 .tile .status { display: none; }
.card-grid.cols-3 .tile .status-dot { display: inline-block; }

/* ── Mobile home: stack carousel + stat-hero cards ── */
@media (max-width: 768px) {
  .mobile-home { padding: 0 0 16px; }

  .stack-wrap {
    position: relative; height: 296px;
    display: flex; align-items: center; justify-content: center;
    margin: 16px 0 10px; cursor: pointer;
  }
  .stack-card.s1 { transform: translateX(-50px) rotate(-8deg) scale(0.92); z-index: 1; opacity: 0.55; }
  .stack-card.s2 { transform: translateX(-24px) rotate(-3deg) scale(0.96); z-index: 2; opacity: 0.82; }
  .stack-card.s3 { z-index: 3; }
  .stack-card {
    position: absolute; width: 188px; aspect-ratio: 5/7;
    border-radius: 12px; padding: 7px;
    box-shadow: 0 0 0 1.5px #0E2418, 0 12px 28px rgba(0, 0, 0, 0.55);
    transition: transform 0.4s cubic-bezier(0.2, 0.7, 0.1, 1), opacity 0.4s;
  }
  .stack-card .inside {
    width: 100%; height: 100%; border-radius: 6px;
    background: radial-gradient(ellipse at 50% 45%, #2D5233, #1B3D2A 55%, #0E2418 100%);
    border: 1.5px solid #0E2418;
    display: flex; align-items: center; justify-content: center; overflow: hidden;
  }
  .stack-card .inside img.real { width: 100%; height: 100%; object-fit: cover; }

  .stack-meta { text-align: center; margin-bottom: 12px; padding: 0 22px; }
  .stack-meta .title {
    font-family: 'Alfa Slab One', serif;
    font-size: 20px; letter-spacing: 0.02em;
    text-transform: uppercase; line-height: 1; margin-bottom: 8px;
  }
  .stack-meta .featured {
    font-family: 'Sora', sans-serif; font-weight: 600;
    font-size: 13px; color: #C9D5BD; margin-bottom: 4px;
  }
  .stack-meta .featured .p {
    font-family: 'Big Shoulders Display', sans-serif;
    font-weight: 900; color: var(--rust-500, #c8541e);
    letter-spacing: -0.005em; font-size: 17px; margin-right: 6px;
  }
  .stack-meta .sub {
    font-family: 'DM Mono', monospace;
    font-size: 9px; letter-spacing: 0.18em;
    text-transform: uppercase; color: var(--rust-500, #c8541e);
  }
  .stack-dots { display: flex; justify-content: center; gap: 6px; margin-bottom: 22px; }
  .stack-dots span { width: 6px; height: 6px; border-radius: 50%; background: rgba(245, 236, 212, 0.25); }
  .stack-dots span.on { background: var(--rust-500, #c8541e); width: 20px; border-radius: 3px; }

  .stat-stack { padding: 8px 22px 28px; display: flex; flex-direction: column; gap: 12px; }
  .stat-hero {
    background: #16321F;
    border: 1.5px solid rgba(245, 236, 212, 0.18);
    border-radius: 20px; padding: 20px 22px;
    position: relative; display: flex; flex-direction: column; gap: 5px; overflow: hidden;
  }
  .stat-hero.rust { background: var(--rust-600, #b04d1a); border: none; }
  .stat-hero .lbl {
    font-family: 'DM Mono', monospace;
    font-size: 10px; letter-spacing: 0.2em;
    text-transform: uppercase; color: #8FA98E;
  }
  .stat-hero.rust .lbl { color: #FBF5DF; opacity: 0.75; }
  .stat-hero .row { display: flex; align-items: flex-end; justify-content: space-between; }
  .stat-hero .v {
    font-family: 'Big Shoulders Display', sans-serif;
    font-weight: 900; font-size: 62px; line-height: 0.9;
    letter-spacing: -0.02em; color: #F5ECD4;
  }
  .stat-hero .v .c { font-size: 0.4em; color: var(--rust-500, #c8541e); }
  .stat-hero.rust .v { color: #FBF5DF; }
  .stat-hero.rust .v .c { color: rgba(251, 245, 223, 0.7); }
  .stat-hero .meta {
    font-family: 'DM Mono', monospace;
    font-size: 10px; letter-spacing: 0.18em;
    text-transform: uppercase; color: var(--rust-500, #c8541e);
  }
  .stat-hero.rust .meta { color: #FBF5DF; opacity: 0.85; }
  .stat-hero .arrow {
    width: 32px; height: 32px; border-radius: 50%;
    background: rgba(245, 236, 212, 0.08);
    display: flex; align-items: center; justify-content: center;
    color: #F5ECD4; font-size: 16px; flex-shrink: 0;
  }
}

/* ── /account responsive ── */
@media (max-width: 768px) {
  .account-page .acct-card,
  .account-page section { width: 100%; max-width: 100%; }

  .account-page input[type="text"],
  .account-page input[type="email"],
  .account-page input[type="tel"],
  .account-page input[type="number"],
  .account-page select,
  .account-page textarea {
    font-size: 16px;
    min-height: 44px;
  }
}

/* ── portal_auth responsive ── */
@media (max-width: 768px) {
  .portal-auth-page .auth-marketing,
  .portal-auth-page .auth-left { display: none; }
  .portal-auth-page .auth-card,
  .portal-auth-page .auth-card-frame,
  .portal-auth-page .auth-right { width: 100%; padding: 24px 22px; }
}

/* ── Sales tab — table to card list ── */
@media (max-width: 768px) {
  .portal-sales .sales-table thead { display: none; }
  .portal-sales .sales-table,
  .portal-sales .sales-table tbody,
  .portal-sales .sales-table tr,
  .portal-sales .sales-table td { display: block; width: 100%; }
  .portal-sales .sales-table tr {
    background: #16321F;
    border: 1.5px solid rgba(245, 236, 212, 0.14);
    border-radius: 14px; padding: 12px;
    margin-bottom: 10px;
  }
  .portal-sales .sales-table td {
    padding: 4px 0; border: none;
    display: flex; justify-content: space-between; align-items: baseline;
  }
  .portal-sales .sales-table td::before {
    content: attr(data-label);
    font-family: 'DM Mono', monospace;
    font-size: 9px; letter-spacing: 0.14em;
    text-transform: uppercase; color: #8FA98E;
  }
}

/* ── Payouts tab — stack head and stats ── */
@media (max-width: 768px) {
  .portal-payouts .payout-head,
  .portal-payouts .payouts-grid {
    grid-template-columns: 1fr !important;
    flex-direction: column !important;
    gap: 12px;
  }
  .portal-payouts .payout-balance { width: 100%; }
  .portal-payouts .stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
}

/* ── /portal/inbox ── */
.portal-inbox-page { padding: 0 22px 16px; }
.portal-inbox-page .cards-head {
  padding: 14px 0 8px;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.portal-inbox-page .cards-head h1 {
  font-family: 'Alfa Slab One', serif;
  font-size: 26px; line-height: 1; letter-spacing: 0.01em; text-transform: uppercase;
  color: var(--p-text, #F5ECD4);
}
.portal-inbox-page .cards-head .sub {
  font-family: 'DM Mono', monospace;
  font-size: 9px; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--rust-500, #c8541e); margin-top: 4px;
}

.inbox-list { display: flex; flex-direction: column; gap: 10px; }
.inbox-row {
  background: #16321F;
  border: 1.5px solid rgba(245, 236, 212, 0.14);
  border-radius: 14px; padding: 14px 16px;
}
.inbox-row[data-read="0"] { border-left: 4px solid var(--rust-500, #c8541e); }
.inbox-row-head {
  display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px;
}
.inbox-type {
  font-family: 'DM Mono', monospace;
  font-size: 9px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--rust-500, #c8541e);
}
.inbox-when {
  font-family: 'DM Mono', monospace;
  font-size: 9px; letter-spacing: 0.12em; color: #8FA98E;
}
.inbox-title {
  font-family: 'Sora', sans-serif; font-weight: 600;
  color: #F5ECD4; font-size: 14px; line-height: 1.3; margin-bottom: 4px;
}
.inbox-body {
  font-family: 'Sora', sans-serif;
  color: #C9D5BD; font-size: 13px; line-height: 1.4;
}

.empty-state {
  text-align: center; padding: 48px 24px;
  background: #16321F;
  border: 1.5px dashed rgba(245, 236, 212, 0.18);
  border-radius: 14px;
}
.empty-heading {
  font-family: 'Alfa Slab One', serif;
  font-size: 18px; letter-spacing: 0.02em;
  text-transform: uppercase; color: #F5ECD4; margin-bottom: 8px;
}
.empty-body { font-family: 'Sora', sans-serif; font-size: 13px; color: #C9D5BD; }

/* ── Theme picker — stack option cards vertically on small screens ── */
@media (max-width: 480px) {
  .tp-options,
  .theme-picker-modal .options,
  .theme-picker .options {
    grid-template-columns: 1fr !important;
    flex-direction: column !important;
  }
  .tp-option,
  .theme-picker-modal .option-card,
  .theme-picker .option-card { width: 100%; }
}

/* ── Safe area top inset for full-bleed pages (sign-in) ── */
@media (max-width: 768px) {
  .portal-auth-page { padding-top: env(safe-area-inset-top); }
}

/* Project E Phase 5 — install nudge */
.install-nudge {
  position: fixed;
  left: 1rem;
  right: 1rem;
  bottom: calc(env(safe-area-inset-bottom, 0) + 4.5rem); /* sit above the tabbar */
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: #111d16;
  border: 1px solid #1c3224;
  border-radius: 12px;
  color: #e2e8f0;
  font-size: 0.95rem;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}
.install-nudge[hidden] { display: none; }
.install-nudge-text { flex: 1; }
.install-nudge-share {
  display: inline-block;
  font-weight: 600;
  color: #86efac;
  margin: 0 0.15rem;
}
.install-nudge-cta {
  background: #e07b39;
  color: #0b140e;
  border: none;
  border-radius: 8px;
  padding: 0.4rem 0.9rem;
  font-weight: 600;
  cursor: pointer;
}
.install-nudge-cta:hover { background: #c46a30; }
.install-nudge-dismiss {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 1.4rem;
  line-height: 1;
  padding: 0 0.25rem;
  cursor: pointer;
}
.install-nudge-dismiss:hover { color: #e2e8f0; }
@media (min-width: 900px) {
  .install-nudge { display: none; }   /* mobile-only nudge */
}
