/* ============================================================
   Giv-able — Desktop / Tablet redesign
   ALL rules scoped under html.is-web @media (min-width: 768px)
   Mobile (< 768px) and Capacitor app are never affected.
   ============================================================ */

@media (min-width: 768px) {

  /* ── Token bridge ───────────────────────────────────────────
     Map the new design token names to the existing app tokens.
     This lets the new component CSS use --bg-0, --fg-1, etc.
     without introducing a second parallel theme system.      */
  html.is-web {
    --bg-0: var(--bg-page);
    --bg-1: #16181c;
    --bg-2: var(--bg-tile);
    --bg-3: #23262c;
    --bg-4: #2e3239;
    --line-1: var(--bg-tile-border);
    --line-2: rgba(255,255,255,0.10);
    --line-3: rgba(255,255,255,0.16);
    --fg-1: var(--text-primary);
    --fg-2: var(--text-secondary);
    --fg-3: #6f7888;
    --fg-4: #4a5161;
    --warn: #F2B544;
    --warn-soft: rgba(242,181,68,0.14);
    --pink: #F26AA7;
    --pink-soft: rgba(242,106,167,0.14);
    --teal: #34C9B6;
    --teal-soft: rgba(52,201,182,0.14);
    --violet: #B07CFF;
    --violet-soft: rgba(176,124,255,0.14);
    --coral: #FF7A6B;
    --coral-soft: rgba(255,122,107,0.14);
    --green: #58D38C;
    --green-soft: rgba(88,211,140,0.14);
    --accent-strong: #3D74E8;
    --accent-soft: rgba(79,139,255,0.14);
    --accent-ring: rgba(79,139,255,0.30);
    --r-sm: 8px;
    --r-md: 12px;
    --r-lg: 16px;
    --r-xl: 22px;
    --shadow-1: 0 1px 0 rgba(255,255,255,0.04) inset, 0 1px 2px rgba(0,0,0,0.3);
    --shadow-2: 0 8px 24px rgba(0,0,0,0.35);
    --sidebar-w: 232px;
    --rail-w: 300px;
    --font-display: "Fraunces", "Inter", serif;
    --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  }

  /* Light mode token bridge */
  html.is-web:not(.theme-dark) {
    --bg-1: #ffffff;
    --bg-2: #faf9f6;
    --bg-3: #f1ede3;
    --bg-4: #e8e3d6;
    --line-1: rgba(20,24,30,0.06);
    --line-2: rgba(20,24,30,0.10);
    --line-3: rgba(20,24,30,0.18);
  }

  /* ── App shell ───────────────────────────────────────────── */
  html.is-web body {
    display: flex;
    flex-direction: row;
    min-height: 100vh;
  }

  /* Main column: flex column so topbar stacks above views */
  html.is-web #mainApp {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    /* Override the old margin-left: 240px from existing CSS */
    margin-left: 0 !important;
  }

  /* Views fill remaining height and scroll internally */
  html.is-web .main-content.view.active {
    flex: 1;
    overflow-y: auto;
    height: auto;
    min-height: 0;
  }

  /* Hide mobile bottom nav on desktop */
  html.is-web .bottom-nav { display: none !important; }

  /* Hide mobile scroll containers when desktop wrap is present */
  html.is-web .view:has(.desk-wrap) > .scroll-container { display: none !important; }

  /* ── Desktop sidebar ─────────────────────────────────────── */
  html.is-web #desktopSidebar {
    width: var(--sidebar-w);
    min-width: var(--sidebar-w);
    height: 100vh;
    background: var(--bg-1);
    border-right: 1px solid var(--line-1);
    display: flex;
    flex-direction: column;
    padding: 22px 14px 18px;
    position: sticky;
    top: 0;
    flex-shrink: 0;
    overflow-y: auto;
    /* Override the old fixed positioning from existing CSS */
    position: sticky !important;
    left: unset !important;
    z-index: 10 !important;
  }

  html.is-web .desk-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 10px 22px;
  }
  html.is-web .desk-brand-mark {
    width: 28px; height: 28px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--violet) 100%);
    display: grid; place-items: center;
    color: white;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 16px;
    box-shadow: 0 4px 14px rgba(79,139,255,0.35);
    flex-shrink: 0;
  }
  html.is-web .desk-brand-name {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 20px;
    letter-spacing: -0.01em;
    color: var(--accent);
  }

  html.is-web .desk-nav-section { display: flex; flex-direction: column; gap: 2px; }
  html.is-web .desk-nav-label {
    font-size: 10.5px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--fg-3);
    padding: 14px 12px 6px;
    font-weight: 600;
  }
  html.is-web .desk-nav-item {
    display: flex; align-items: center;
    gap: 12px;
    padding: 9px 12px;
    border-radius: 10px;
    color: var(--fg-2);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: 0;
    background: transparent;
    text-align: left;
    width: 100%;
    transition: background .15s, color .15s;
    font-family: inherit;
  }
  html.is-web .desk-nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
  html.is-web .desk-nav-item:hover { background: var(--bg-2); color: var(--fg-1); }
  html.is-web .desk-nav-item.active {
    background: var(--accent-soft);
    color: var(--accent);
    box-shadow: inset 0 0 0 1px var(--accent-ring);
  }

  html.is-web .desk-sidebar-foot {
    margin-top: auto;
    display: flex; flex-direction: column; gap: 8px;
  }
  html.is-web .desk-user-row {
    display: flex; align-items: center; gap: 10px;
    padding: 8px;
    border-radius: 12px;
    cursor: pointer;
  }
  html.is-web .desk-user-row:hover { background: var(--bg-2); }
  html.is-web .desk-avatar-initials {
    width: 36px; height: 36px; border-radius: 999px;
    background: linear-gradient(135deg, #6f7888, #4a5161);
    color: white; font-weight: 600; font-size: 13px;
    display: grid; place-items: center;
    flex-shrink: 0;
  }
  html.is-web .desk-user-name { font-size: 13.5px; font-weight: 600; color: var(--fg-1); }
  html.is-web .desk-user-handle { font-size: 11.5px; color: var(--fg-3); }

  /* ── Desktop topbar ─────────────────────────────────────── */
  html.is-web #desktopTopbar {
    height: 56px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 28px;
    border-bottom: 1px solid var(--line-1);
    background: var(--bg-page);
    backdrop-filter: blur(12px);
    flex-shrink: 0;
    z-index: 5;
  }
  html.is-web .desk-crumb { color: var(--fg-3); font-size: 13px; }
  html.is-web .desk-crumb b { color: var(--fg-1); font-weight: 600; }
  html.is-web .desk-topbar-spacer { flex: 1; }
  html.is-web .desk-search {
    display: flex; align-items: center; gap: 8px;
    background: var(--bg-2);
    border: 1px solid var(--line-1);
    border-radius: 10px;
    padding: 6px 10px;
    width: 240px;
    color: var(--fg-3);
    font-size: 13px;
  }
  html.is-web .desk-search input {
    background: transparent; border: 0; outline: 0;
    color: var(--fg-1); font: inherit; flex: 1; min-width: 0;
  }
  html.is-web .desk-kbd {
    font-family: var(--font-mono); font-size: 10.5px;
    color: var(--fg-3);
    border: 1px solid var(--line-2);
    padding: 1px 5px; border-radius: 4px;
    background: var(--bg-1);
  }
  html.is-web .desk-icon-btn {
    width: 34px; height: 34px;
    display: grid; place-items: center;
    border-radius: 10px;
    background: var(--bg-2);
    border: 1px solid var(--line-1);
    color: var(--fg-2);
    cursor: pointer;
    font-family: inherit;
  }
  html.is-web .desk-icon-btn:hover { color: var(--fg-1); background: var(--bg-3); }
  html.is-web .desk-btn {
    display: inline-flex; align-items: center; gap: 8px;
    height: 34px; padding: 0 14px;
    border-radius: 10px;
    background: var(--bg-3);
    color: var(--fg-1);
    border: 1px solid var(--line-1);
    font-size: 13px; font-weight: 500;
    cursor: pointer;
    font-family: inherit;
  }
  html.is-web .desk-btn:hover { background: var(--bg-4); }
  html.is-web .desk-btn.primary {
    background: var(--accent);
    color: white; border-color: transparent;
    box-shadow: 0 4px 14px rgba(79,139,255,0.28), inset 0 1px 0 rgba(255,255,255,0.18);
  }
  html.is-web .desk-btn.primary:hover { background: var(--accent-strong); }
  html.is-web .desk-btn.sm { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 8px; }
  html.is-web .desk-btn.ghost { background: transparent; border-color: transparent; }

  /* ── Desktop page layout ────────────────────────────────── */
  html.is-web .desk-wrap {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) var(--rail-w);
    gap: 28px;
    padding: 24px 28px 80px;
    max-width: 1480px;
    width: 100%;
    align-content: start;
  }
  html.is-web .desk-wrap.no-rail {
    grid-template-columns: minmax(0, 1fr);
    max-width: 1180px;
  }
  html.is-web .desk-col { min-width: 0; display: flex; flex-direction: column; gap: 20px; }
  html.is-web .desk-rail { display: flex; flex-direction: column; gap: 16px; }

  /* Util */
  html.is-web .desk-row { display: flex; align-items: center; gap: 10px; }
  html.is-web .desk-between { display: flex; align-items: center; justify-content: space-between; }
  html.is-web .desk-muted { color: var(--fg-3); }
  html.is-web .desk-tiny { font-size: 11.5px; }


  /* ── Card ──────────────────────────────────────────────── */
  html.is-web .desk-card {
    background: var(--bg-2);
    border: 1px solid var(--line-1);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-1);
  }
  html.is-web .desk-card-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--line-1);
  }
  html.is-web .desk-card-title { font-size: 13.5px; font-weight: 600; color: var(--fg-1); }
  html.is-web .desk-eyebrow {
    font-size: 10.5px; letter-spacing: 0.14em;
    text-transform: uppercase; color: var(--fg-3); font-weight: 600;
  }

  /* ── Page head ──────────────────────────────────────────── */
  html.is-web .desk-page-head {
    display: flex; align-items: flex-end; justify-content: space-between;
    flex-wrap: wrap; gap: 12px;
    margin-bottom: 4px;
  }
  html.is-web .desk-page-title {
    font-family: var(--font-display);
    font-weight: 600; font-size: 30px;
    letter-spacing: -0.02em; color: var(--fg-1); margin: 0;
  }
  html.is-web .desk-page-sub { color: var(--fg-3); font-size: 13.5px; margin: 4px 0 0; }

  /* ── Chips ──────────────────────────────────────────────── */
  html.is-web .desk-chips { display: flex; gap: 6px; flex-wrap: wrap; }
  html.is-web .desk-chip {
    display: inline-flex; align-items: center; gap: 6px;
    height: 30px; padding: 0 12px;
    border-radius: 999px;
    background: var(--bg-2); border: 1px solid var(--line-1);
    color: var(--fg-2); font-size: 12.5px; font-weight: 500; cursor: pointer;
    font-family: inherit;
  }
  html.is-web .desk-chip:hover { color: var(--fg-1); background: var(--bg-3); }
  html.is-web .desk-chip.active {
    background: var(--accent-soft); color: var(--accent); border-color: var(--accent-ring);
  }
  html.is-web .desk-chip .dot { width: 6px; height: 6px; border-radius: 999px; }

  /* ── Avatar ─────────────────────────────────────────────── */
  html.is-web .desk-av {
    border-radius: 999px;
    display: grid; place-items: center;
    color: white; font-weight: 600; overflow: hidden;
    flex-shrink: 0;
  }

  /* ── Tile icon ──────────────────────────────────────────── */
  html.is-web .desk-tile {
    width: 38px; height: 38px; border-radius: 11px;
    display: grid; place-items: center;
    flex-shrink: 0; color: white; position: relative;
    box-shadow:
      0 0 0 1px rgba(255,255,255,0.06) inset,
      0 1px 0 rgba(255,255,255,0.22) inset,
      0 6px 14px rgba(0,0,0,0.25),
      0 0 22px var(--tile-glow, rgba(79,139,255,0.55)),
      0 0 44px var(--tile-glow-2, rgba(79,139,255,0.35));
  }
  html.is-web .desk-tile.lg { width: 48px; height: 48px; border-radius: 14px; }
  html.is-web .desk-tile.sm { width: 30px; height: 30px; border-radius: 9px; }

  /* ── Banner (birthday / hero) ───────────────────────────── */
  html.is-web .desk-banner {
    position: relative;
    background:
      radial-gradient(60% 140% at 8% 0%, rgba(242,106,167,0.28), transparent 55%),
      radial-gradient(60% 140% at 100% 100%, rgba(255,122,107,0.24), transparent 55%),
      radial-gradient(40% 100% at 50% 100%, rgba(242,181,68,0.16), transparent 60%),
      var(--bg-2);
    border: 1px solid var(--line-2);
    border-radius: var(--r-lg);
    padding: 18px 20px;
    display: flex; align-items: center; gap: 16px;
    box-shadow: 0 0 60px rgba(242,106,167,0.10);
  }
  html.is-web .desk-banner-eyebrow {
    font-size: 10.5px; letter-spacing: 0.14em;
    text-transform: uppercase; color: var(--warn); font-weight: 600;
  }

  /* ── Quick action card ──────────────────────────────────── */
  html.is-web .desk-qa {
    display: flex; gap: 14px; align-items: flex-start;
    padding: 16px;
    background: var(--bg-2); border: 1px solid var(--line-1);
    border-radius: var(--r-lg); cursor: pointer;
    text-align: left; width: 100%; color: inherit;
    position: relative; overflow: hidden;
    transition: border-color .15s, background .15s;
    font-family: inherit;
  }
  html.is-web .desk-qa:hover { background: var(--bg-3); border-color: var(--line-2); }
  html.is-web .desk-qa::before {
    content: "";
    position: absolute; inset: -40% -40% auto auto;
    width: 220px; height: 220px;
    background: radial-gradient(closest-side, var(--card-glow, transparent), transparent 70%);
    opacity: 0.5; pointer-events: none;
    transition: opacity .25s;
  }
  html.is-web .desk-qa:hover::before { opacity: 0.85; }
  html.is-web .desk-qa-title { font-size: 14.5px; font-weight: 600; color: var(--fg-1); }
  html.is-web .desk-qa-sub { font-size: 12.5px; color: var(--fg-3); margin-top: 2px; }

  /* ── Friend card ────────────────────────────────────────── */
  html.is-web .desk-friend-card {
    display: flex; flex-direction: column; gap: 10px;
    padding: 14px;
    background: var(--bg-2); border: 1px solid var(--line-1);
    border-radius: var(--r-lg); cursor: pointer;
    transition: border-color .15s, transform .15s;
  }
  html.is-web .desk-friend-card:hover { border-color: var(--line-3); transform: translateY(-1px); }

  /* ── Profile hero ───────────────────────────────────────── */
  html.is-web .desk-profile-hero {
    position: relative; overflow: hidden;
  }
  html.is-web .desk-profile-hero::before {
    content: "";
    position: absolute; inset: -80px -120px auto auto;
    width: 360px; height: 360px;
    background: radial-gradient(closest-side, rgba(79,139,255,0.22), transparent 70%);
    pointer-events: none;
  }
  html.is-web .desk-profile-hero::after {
    content: "";
    position: absolute; inset: auto auto -120px -100px;
    width: 320px; height: 320px;
    background: radial-gradient(closest-side, rgba(176,124,255,0.18), transparent 70%);
    pointer-events: none;
  }

  /* ── Recently viewed row ────────────────────────────────── */
  html.is-web .desk-recent-row { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; }
  html.is-web .desk-recent {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    min-width: 56px; cursor: pointer;
  }
  html.is-web .desk-recent-name { font-size: 11.5px; color: var(--fg-2); max-width: 64px; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

} /* end @media */

