/* ==========================================================================
   LH Sales Toolkit — Device preview harness
   A review aid for opening the app on a desktop browser. It is removed
   entirely when running inside LINE (assets/js/preview.js never mounts it),
   so nothing here ships to a real LIFF session on a phone.

     html.pv-mobile   → wrap the app in a phone bezel (default on desktop)
     html.pv-desktop  → let the app use the full desktop layout
   ========================================================================== */

/* ---- Phone bezel ------------------------------------------------------- */

.pv-mobile body {
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: 26px 16px 92px;
  background:
    radial-gradient(900px 520px at 50% -18%, #dde6f2 0%, transparent 70%),
    linear-gradient(180deg, #eaeef4 0%, #dee4ed 100%);
}

.pv-mobile .device {
  display: block;
  position: relative;
  flex: 0 0 auto;
  width: 390px;
  height: min(844px, calc(100dvh - 118px));
  padding: 11px;
  background: #0a0d12;
  border-radius: 54px;
  box-shadow:
    0 34px 70px rgba(14, 27, 42, .38),
    0 4px 12px rgba(14, 27, 42, .2),
    inset 0 0 0 2px #2a3140;
}

/* Dynamic-island style notch, purely cosmetic. */
.pv-mobile .device::after {
  content: "";
  position: absolute;
  top: 22px;
  left: 50%;
  z-index: 40;
  width: 108px;
  height: 26px;
  background: #0a0d12;
  border-radius: var(--r-pill);
  transform: translateX(-50%);
  pointer-events: none;
}

/* Inside the bezel the app is its own scroll context: the app bar and tab bar
   stay put and only .main scrolls. Position:fixed would otherwise escape the
   bezel and stick to the desktop viewport. */
.pv-mobile .app {
  position: relative; /* anchor for the absolutely-placed toast host + sheet */
  height: 100%;
  min-height: 0;
  overflow: hidden;
  border-radius: 43px;
}

/* The cosmetic notch sits 22px-48px down the bezel, and .app starts at the
   bezel's 11px padding — so the bar needs 37px+ of top padding to clear it. */
.pv-mobile .appbar {
  position: static;
  padding-top: 44px;
  /* min-height includes the padding, so without this the title sits flush on
     the bar's bottom edge and Thai descenders (ฎ ฏ ญ) clip. */
  padding-bottom: 8px;
}

.pv-mobile .main {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.pv-mobile .app--has-tabbar .main { padding-bottom: calc(var(--gutter) + 8px); }
.pv-mobile .tabbar { position: static; padding-bottom: 8px; }
.pv-mobile .toast-host { position: absolute; bottom: 90px; }
.pv-mobile .sheet-backdrop { position: absolute; border-radius: 43px; overflow: hidden; }

/* ---- Toggle control --------------------------------------------------- */

.pv-bar {
  position: fixed;
  bottom: 18px;
  left: 50%;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px;
  background: rgba(255, 255, 255, .92);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  box-shadow: var(--sh-3);
  backdrop-filter: blur(10px);
  transform: translateX(-50%);
}

.pv-bar__label {
  padding: 0 8px 0 10px;
  font-size: var(--fs-11);
  font-weight: 700;
  letter-spacing: .05em;
  color: var(--text-3);
  text-transform: uppercase;
}

.pv-bar__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  font-size: var(--fs-12);
  font-weight: 600;
  color: var(--text-2);
  border-radius: var(--r-pill);
  transition: background var(--t-fast), color var(--t-fast);
}

.pv-bar__btn svg { width: 15px; height: 15px; }
.pv-bar__btn:hover { background: var(--surface-3); }

.pv-bar__btn.is-active {
  color: var(--primary-ink);
  background: var(--primary);
}

.pv-bar__sep {
  width: 1px;
  height: 20px;
  margin: 0 3px;
  background: var(--border);
}

/* Role switcher — review aid only. In production the role comes from the
   CRM account bound at registration (spec 1.3-1.4). */
.pv-bar__role {
  padding: 7px 10px;
  font-size: var(--fs-12);
  font-weight: 600;
  color: var(--text-2);
  background: transparent;
  border: 0;
  border-radius: var(--r-pill);
  cursor: pointer;
}

.pv-bar__role:hover { background: var(--surface-3); }

@media (max-width: 719px) {
  .pv-bar { display: none; }
}

@media (max-width: 460px) {
  .pv-mobile .device {
    width: 100%;
    height: auto;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
  }
  .pv-mobile .device::after { display: none; }
  .pv-mobile body { display: block; padding: 0; background: var(--bg); }
  .pv-mobile .app { height: auto; min-height: 100dvh; overflow: visible; border-radius: 0; }
  .pv-mobile .appbar { padding-top: env(safe-area-inset-top); }
  .pv-mobile .tabbar { position: fixed; top: auto; margin-top: 0; }
}
