/* OrbePay — shell nativo (PWA / Play Store / App Store) */

html.app-shell,
html.app-shell body {
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

html.is-mobile .mobile-top,
html.is-mobile .mobile-tabbar,
html.is-mobile .dash-m-label,
html.is-mobile .side-label {
  -webkit-user-select: none;
  user-select: none;
}

html.is-standalone {
  background: #030a14;
}

html.is-standalone body {
  min-height: 100dvh;
  min-height: -webkit-fill-available;
}

/* ── Splash (iOS/Android standalone) ── */
.app-splash {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 400;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: #030a14;
  padding-bottom: env(safe-area-inset-bottom);
  pointer-events: none;
}

html.is-standalone:not(.is-app-ready) .app-splash {
  display: flex;
}

.app-splash__mark {
  width: 92px;
  height: 92px;
  border-radius: 22px;
  overflow: hidden;
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.45),
    0 0 32px rgba(0, 153, 255, 0.28);
}

.app-splash__mark img {
  display: block;
  width: 100%;
  height: 100%;
}

.app-splash__name {
  font-family: var(--font, system-ui);
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #eef5ff;
  font-size: 1.18rem;
}

.app-splash__loading {
  margin-top: 2px;
  font-family: var(--font-body, system-ui);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #8aa3bd;
  animation: splash-load-fade 1.6s ease-in-out infinite;
}

.app-splash__dot {
  display: inline-block;
  min-width: 0.35em;
  animation: splash-dot 1.2s ease-in-out infinite;
  opacity: 0.18;
}

.app-splash__dot:nth-child(1) { animation-delay: 0s; }
.app-splash__dot:nth-child(2) { animation-delay: 0.2s; }
.app-splash__dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes splash-dot {
  0%, 70%, 100% { opacity: 0.18; transform: translateY(0); }
  35% { opacity: 1; transform: translateY(-2px); }
}

@keyframes splash-load-fade {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

html.is-app-ready .app-splash {
  opacity: 0;
  visibility: hidden;
  pointer-events: none !important;
  transition: opacity 0.38s ease, visibility 0.38s ease;
}
html.is-app-ready .app-splash[hidden],
html.is-desktop .app-splash {
  display: none !important;
}

.app-splash[hidden] {
  display: none !important;
}

@keyframes app-spin {
  to { transform: rotate(360deg); }
}

/* ── Offline ── */
.app-offline {
  position: sticky;
  top: 0;
  z-index: 75;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 14px;
  padding-top: max(8px, env(safe-area-inset-top));
  background: #7a1d1d;
  color: #ffe4e4;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-align: center;
}

html.is-offline .app-offline,
body.is-offline .app-offline {
  display: flex;
}

html.is-mobile.is-offline .app-offline {
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
}

html.is-mobile.is-offline .mobile-top {
  top: 32px !important;
}

/* ── Pull to refresh ── */
.ptr-layer {
  position: fixed;
  left: 0;
  right: 0;
  top: calc(env(safe-area-inset-top, 0px) + 52px);
  height: 56px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  pointer-events: none;
  z-index: 58;
  opacity: 0;
  transform: translate3d(0, -12px, 0);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

html.is-ptr-pull .ptr-layer,
html.is-ptr-refresh .ptr-layer,
html.is-ptr-snap .ptr-layer {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

.ptr-spinner {
  width: 28px;
  height: 28px;
  margin-top: 6px;
  border-radius: 50%;
  border: 2.4px solid rgba(51, 214, 255, 0.16);
  border-top-color: #33d6ff;
  box-shadow: 0 0 16px rgba(0, 153, 255, 0.28);
  background: rgba(3, 10, 20, 0.55);
}

html.is-mobile.is-ptr-pull,
html.is-mobile.is-ptr-refresh {
  overflow: hidden;
}

html.is-ptr-refresh .ptr-spinner {
  animation: app-spin 0.68s linear infinite;
}

html.is-mobile.is-ptr-pull .panel > .content:not([hidden]),
html.is-mobile.is-ptr-refresh .panel > .content:not([hidden]),
html.is-mobile.is-ptr-snap .panel > .content:not([hidden]),
html.is-mobile.is-ptr-pull .panel > .section-view:not([hidden]),
html.is-mobile.is-ptr-refresh .panel > .section-view:not([hidden]),
html.is-mobile.is-ptr-snap .panel > .section-view:not([hidden]) {
  transform: translate3d(0, var(--app-pull, 0px), 0);
  will-change: transform;
}

html.is-mobile.is-ptr-snap .panel > .content:not([hidden]),
html.is-mobile.is-ptr-snap .panel > .section-view:not([hidden]) {
  transition: transform 0.34s cubic-bezier(0.32, 0.72, 0, 1);
}

/* ── Action sheet iOS/Android ── */
.app-sheet-root {
  position: fixed;
  inset: 0;
  z-index: 220;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  pointer-events: none;
}

.app-sheet-root:not([hidden]) {
  pointer-events: auto;
}

.app-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.46);
  opacity: 0;
  transition: opacity 0.22s ease;
}

.app-sheet-root.is-on .app-sheet-backdrop {
  opacity: 1;
}

.app-sheet {
  position: relative;
  margin: 0 10px calc(10px + env(safe-area-inset-bottom));
  transform: translate3d(0, 110%, 0);
  transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
}

.app-sheet-root.is-on .app-sheet {
  transform: translate3d(0, 0, 0);
}

.app-sheet__group,
.app-sheet__cancel {
  background: rgba(22, 32, 48, 0.94);
  backdrop-filter: blur(22px) saturate(1.4);
  -webkit-backdrop-filter: blur(22px) saturate(1.4);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  overflow: hidden;
}

.app-sheet__handle {
  width: 36px;
  height: 5px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.22);
  margin: 8px auto 4px;
}

.app-sheet__list {
  display: flex;
  flex-direction: column;
}

.app-sheet__item {
  appearance: none;
  border: 0;
  background: transparent;
  color: #5ec8ff;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 600;
  padding: 16px 18px;
  text-align: center;
  cursor: pointer;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  -webkit-tap-highlight-color: transparent;
}

.app-sheet__item:first-child {
  border-top: 0;
}

.app-sheet__item:active {
  background: rgba(255, 255, 255, 0.08);
}

.app-sheet__item.is-danger {
  color: #ff7b7b;
}

.app-sheet__item.is-primary {
  color: #33d6ff;
  font-weight: 800;
}

.app-sheet__cancel {
  display: block;
  width: 100%;
  margin-top: 8px;
  appearance: none;
  border: 0;
  color: #fff;
  font-family: inherit;
  font-size: 1.08rem;
  font-weight: 800;
  padding: 16px;
  text-align: center;
  cursor: pointer;
}

.app-sheet__cancel:active {
  background: rgba(40, 52, 70, 0.96);
}

.app-sheet-root[hidden] {
  display: none !important;
}

/* ── Tabbar nativo ── */
html.is-standalone .mobile-tabbar,
html.is-mobile .mobile-tabbar {
  padding-bottom: max(8px, env(safe-area-inset-bottom)) !important;
}

html.is-mobile .mobile-tabbar .tab span {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

html.is-mobile .dash-m-card:active {
  transform: scale(0.985);
}

html.is-mobile .dash-m-action:active {
  transform: scale(0.96);
}

html.is-mobile .dash-m-menu:active {
  color: #cfefff;
  transform: scale(0.9);
}

/* ── Swipe-back shadow ── */
html.is-swiping-back #viewTxDetail {
  box-shadow: -18px 0 40px rgba(0, 0, 0, 0.35);
}

/* ── Gestos (config) ── */
.app-gestures {
  list-style: none;
  display: grid;
  gap: 12px;
  margin: 4px 0 16px;
  padding: 0;
}

.app-gestures li {
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(0, 184, 255, 0.12);
}

.app-gestures strong {
  display: block;
  color: #eef5ff;
  font-size: 0.9rem;
  margin-bottom: 4px;
}

.app-gestures span {
  color: var(--ink-soft, #a9bdd6);
  font-size: 0.82rem;
  line-height: 1.4;
}

.side-logout,
.cfg-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  appearance: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  color: #ff8a8a;
  background: rgba(255, 80, 80, 0.08);
  border: 1px solid rgba(255, 110, 110, 0.22);
  border-radius: 14px;
  padding: 13px 14px;
  -webkit-tap-highlight-color: transparent;
}

.side-logout {
  margin-top: 4px;
  flex-shrink: 0;
}

.cfg-logout {
  margin-top: 18px;
}

.side-logout:active,
.cfg-logout:active {
  transform: scale(0.98);
  background: rgba(255, 80, 80, 0.16);
}

html.is-mobile .cfg-logout {
  min-height: 48px;
  font-size: 1.02rem;
}

/* ── Ocultar valores (Nubank-like) ── */
.dash-hide-btn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(0, 180, 255, 0.2);
  background: rgba(255, 255, 255, 0.04);
  color: #b8d4ea;
  box-shadow: 0 0 16px rgba(0, 140, 255, 0.12);
  cursor: pointer;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
}

.dash-hide-btn .ico-eye-off { display: none; }
html.is-values-hidden .dash-hide-btn .ico-eye { display: none; }
html.is-values-hidden .dash-hide-btn .ico-eye-off { display: block; }

.dash-hide-btn:active {
  transform: scale(0.94);
}

.dash-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.dash-hide-btn--desk {
  width: 36px;
  height: 36px;
  color: #cfe8ff;
}

html.app-shell .gw-footer,
html.is-mobile .gw-footer,
html.is-standalone .gw-footer {
  display: none !important;
}

html.is-values-hidden .dash-m-value,
html.is-values-hidden .dash-m-goal-value,
html.is-values-hidden .dash-m-profit__value,
html.is-values-hidden .dash-m-profit__sub,
html.is-values-hidden .dash-m-stat strong,
html.is-values-hidden .dash-m-recent__right strong,
html.is-values-hidden .kpi-card > strong,
html.is-values-hidden #kpiProfitSub,
html.is-values-hidden #kpiPendingCount,
html.is-values-hidden #dashAchVolume,
html.is-values-hidden #dashAchPct,
html.is-values-hidden #saldoValue,
html.is-values-hidden #saldoPendingNote,
html.is-values-hidden #donutMainPct,
html.is-values-hidden #lineChart,
html.is-values-hidden .legend {
  filter: blur(9px);
  user-select: none;
  pointer-events: none;
}

@media (min-width: 961px) {
  .ptr-layer,
  .app-splash,
  .app-sheet-root {
    display: none !important;
    pointer-events: none !important;
    visibility: hidden !important;
  }
}

html.is-desktop .ptr-layer,
html.is-desktop .app-splash,
html.is-desktop .app-sheet-root,
html.is-desktop #ptrLayer,
html.is-desktop #appSplash,
html.is-desktop #appSheet {
  display: none !important;
  pointer-events: none !important;
  visibility: hidden !important;
}

html.is-desktop.app-shell,
html.is-desktop.app-shell body {
  touch-action: auto;
  overscroll-behavior: auto;
}

html.is-desktop .panel {
  display: grid !important;
  grid-template-columns: 260px minmax(0, 1fr) !important;
  grid-template-areas: "nav main";
}

html.is-desktop .panel > .sidebar {
  grid-area: nav !important;
  transform: none !important;
  will-change: auto !important;
}

html.is-desktop .panel > .main {
  grid-area: main !important;
  min-width: 0 !important;
  position: relative !important;
}

html.is-desktop .panel > .main > .content:not([hidden]),
html.is-desktop .panel > .main > .section-view:not([hidden]) {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  transform: none !important;
  animation: none !important;
  pointer-events: auto !important;
}

html.is-desktop .view-loader,
html.is-desktop #viewLoader {
  display: none !important;
  pointer-events: none !important;
  opacity: 0 !important;
}

.pwa-push-gate {
  position: fixed;
  inset: 0;
  z-index: 480;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 18px 14px calc(18px + env(safe-area-inset-bottom));
  background: rgba(2, 8, 16, 0.72);
  backdrop-filter: blur(10px);
}

.pwa-push-gate[hidden] {
  display: none !important;
}

.pwa-push-gate__card {
  position: relative;
  width: min(100%, 420px);
  border-radius: 22px;
  padding: 22px 18px 18px;
  background: #07111d;
  border: 1px solid rgba(0, 184, 255, 0.32);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
  text-align: center;
  color: #eef5ff;
}

.pwa-push-gate__close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  background: rgba(157, 180, 204, 0.12);
  color: #eef5ff;
  font-size: 1.45rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.pwa-push-gate__close:active {
  background: rgba(157, 180, 204, 0.22);
}

.pwa-push-gate__card img {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  margin-bottom: 12px;
}

.pwa-push-gate__card h2 {
  margin: 0 0 8px;
  font-size: 1.18rem;
}

.pwa-push-gate__card p {
  margin: 0 0 16px;
  color: #9db4cc;
  font-size: 0.92rem;
  line-height: 1.45;
}

.pwa-push-gate__card .btn {
  width: 100%;
}

html.is-desktop .pwa-push-gate {
  display: none !important;
}
