/* ============================================================
   MyroPay Business - Desktop Layout
   Loaded after styles.css. Every rule here is scoped to
   html[data-device="desktop"] (set by js/responsive.js before first
   paint) — this file adds a desktop layout, it never overrides or
   removes a mobile rule. Deleting this <link> returns the app to
   exactly the mobile-only experience.

   Same two-pane pattern as app.myropay.com: a persistent left
   sidebar (pane 1) replaces the bottom nav, and the existing header
   + screens render in the right-hand content pane (pane 2). No
   screen markup was rebuilt for desktop — every .screen div, and
   navigateTo(), is reused as-is.
   ============================================================ */

.side-nav { display: none; }

html[data-device="desktop"] body {
  height: auto;
  min-height: 100vh;
  overflow: auto;
}

html[data-device="desktop"] .app {
  max-width: none;
  width: 100%;
  height: auto;
  min-height: 100vh;
}

/* ── Auth screens: keep the existing card design, just let it
   breathe on a full-size canvas instead of forcing a 430px frame. ── */
html[data-device="desktop"] .auth-wrap {
  max-width: 440px;
  width: 100%;
  margin: 0 auto;
  min-height: 100vh;
  overflow-y: visible;
}

/* ── Authenticated shell: three-pane grid (sidebar / content / rail) ── */
html[data-device="desktop"] #main-app.app-visible {
  display: grid;
  grid-template-columns: 264px 1fr 300px;
  grid-template-rows: auto 1fr;
  grid-template-areas:
    "side header header"
    "side main   rail";
  height: 100vh;
  max-width: none;
  /* See app.myropay.com/css/desktop.css for the full explanation — same
     shell pattern, same fix. */
  overflow: visible;
}

html[data-device="desktop"] .header {
  grid-area: header;
  padding: 18px 36px;
  border-bottom: 1px solid var(--border);
}

html[data-device="desktop"] #screen-container {
  grid-area: main;
  padding: 28px 0 48px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  /* See app.myropay.com/css/desktop.css for the full explanation. */
  overflow-y: auto;
  min-height: 0;
}

html[data-device="desktop"] #screen-container .screen {
  width: 100%;
  max-width: 640px;
  padding-left: 12px;
  padding-right: 12px;
}

/* Home gets a wider dashboard column instead of the shared 640px form
   cap every other screen uses (selector includes #screen-container so
   it out-specifies the shared cap above rather than relying on order). */
html[data-device="desktop"] #screen-container #screen-home {
  max-width: 860px;
}

/* Stat grid and tools read as a cramped single column at 860px wide —
   give Home's own grids more columns on desktop. */
html[data-device="desktop"] #screen-home .stat-grid {
  grid-template-columns: repeat(4, 1fr);
}

html[data-device="desktop"] .bottom-nav { display: none; }

/* ── Pane 1: sidebar ── */
html[data-device="desktop"] .side-nav {
  grid-area: side;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 18px 14px 24px;
  border-right: 1px solid var(--border);
  background: var(--bg-secondary);
  overflow-y: auto;
}

html[data-device="desktop"] .side-nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--text-primary);
  padding: 8px 10px 22px;
  cursor: pointer;
}

html[data-device="desktop"] .side-nav-logo .logo-mark {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

html[data-device="desktop"] .side-nav-section {
  font-size: .66rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  padding: 16px 12px 6px;
}

html[data-device="desktop"] .side-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: .87rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  background: none;
  text-align: left;
  font-family: var(--font-body);
  width: 100%;
  transition: background .15s ease, color .15s ease;
}

html[data-device="desktop"] .side-link .side-link-icon {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .82rem;
  border-radius: 9px;
  color: #fff;
  background: linear-gradient(150deg, var(--c1, var(--brand)), var(--c2, var(--brand-dark)) 120%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.3), 0 6px 14px -6px var(--sh, var(--brand-glow));
}

html[data-device="desktop"] .side-link:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

html[data-device="desktop"] .side-link.active {
  background: var(--brand-glow);
  color: var(--brand);
}

html[data-device="desktop"] .header-actions {
  gap: 14px;
}

/* ── Right rail (pane 3): collection account + payment link, desktop-only ── */
.desktop-rail { display: none; }
html[data-device="desktop"] .desktop-rail {
  grid-area: rail;
  display: block;
  padding: 24px 22px 24px 0;
  overflow-y: auto;
  border-left: 1px solid var(--border);
}
html[data-device="desktop"] .rail-head {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-tertiary);
  padding: 4px 4px 10px;
}
html[data-device="desktop"] .rail-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 22px;
}
html[data-device="desktop"] .rail-tag-card { text-align: center; }
html[data-device="desktop"] .rail-tag {
  display: inline-flex;
  background: var(--brand);
  color: #000;
  font-weight: 700;
  font-size: .8rem;
  padding: 6px 14px;
  border-radius: 20px;
  margin-bottom: 10px;
}
html[data-device="desktop"] .rail-tag-sub {
  font-size: .72rem;
  color: var(--text-tertiary);
}

/* Below 1280px the rail would crowd the content pane (this is still
   "desktop" per the 1024px breakpoint in responsive.js) — drop to the
   two-pane layout and let the content column take the space back. */
@media (max-width: 1280px) {
  html[data-device="desktop"] #main-app.app-visible {
    grid-template-columns: 264px 1fr;
    grid-template-areas:
      "side header"
      "side main";
  }
  html[data-device="desktop"] .desktop-rail { display: none; }
}