/* EdgePath interface finish: shared responsive controls, menus and overlays. */
:root {
  --ep-ui-green: #064e3b;
  --ep-ui-green-2: #0b6b51;
  --ep-ui-mint: #dff5eb;
  --ep-ui-ink: #10231d;
  --ep-ui-border: rgba(6, 78, 59, .16);
  --ep-ui-radius: 12px;
  --ep-ui-shadow: 0 14px 36px -22px rgba(6, 78, 59, .38);
}

/* EdgePath mark: NO white backdrop anywhere. The supplied PNG is a dark-green
   glyph on a transparent canvas. On light surfaces it stays natural; on the
   app's dark surfaces (sidebar rails, auth cover hero, dark preloader) it is
   forced WHITE so it stays legible with no white box around it. */
img[src$="assets/img/logo.png"], img[src="assets/img/logo.png"], img[src="../assets/img/logo.png"] {
  box-sizing: border-box;
  object-fit: contain;
  background: transparent !important;
  padding: 0 !important;
  border-radius: 0 !important;
  filter: none !important;
}
#edgepathSidebar img[src$="assets/img/logo.png"],
#edgepathSidebar img[src="assets/img/logo.png"],
#edgepathSidebar img[src="../assets/img/logo.png"],
#epTopHeader img[src$="assets/img/logo.png"],
#epTopHeader img[src="assets/img/logo.png"],
.auth-logo img[src$="assets/img/logo.png"],
.auth-logo img[src="assets/img/logo.png"],
html.dark #ep-logo img[src$="assets/img/logo.png"],
html.dark .ep-spinner-logo {
  background: transparent !important;
  filter: brightness(0) invert(1) !important;
}

/* Controls have a quiet, consistent shape and a visible keyboard focus state. */
button, [role="button"], input[type="button"], input[type="submit"], input[type="reset"] {
  border-radius: var(--ep-ui-radius);
}
button:focus-visible, [role="button"]:focus-visible, a:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(13, 128, 96, .28) !important;
  outline-offset: 2px;
}
button:not(:disabled), [role="button"]:not([aria-disabled="true"]) {
  transition: transform .18s cubic-bezier(.2,.8,.2,1), box-shadow .18s ease, background-color .18s ease, border-color .18s ease, color .18s ease;
}
button:not(:disabled):active, [role="button"]:not([aria-disabled="true"]):active { transform: translateY(1px); }

/* Applied by ep-control-normalize.js.  Text actions and icon actions share
   one compact, rectangular system while menu links and choice chips remain
   purpose-specific controls. */
.ep-control {
  min-height: 42px;
  border-radius: 10px !important;
  font-weight: 700 !important;
  line-height: 1.2;
  letter-spacing: .005em;
  text-decoration: none;
  text-wrap: balance;
}
.ep-control:not(.ep-icon-control) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding-inline: 14px;
}
.ep-control.ep-icon-control {
  width: 42px;
  height: 42px;
  min-width: 42px;
  min-height: 42px;
  padding: 0 !important;
  display: inline-grid;
  place-items: center;
  border-radius: 10px !important;
}
.ep-control.ep-icon-control-compact { width:34px; height:34px; min-width:34px; min-height:34px; }
.ep-control.ep-icon-control svg, .ep-control.ep-icon-control i { width:18px; height:18px; }
.ep-control:disabled, .ep-control[aria-disabled="true"] { cursor:not-allowed; opacity:.55; box-shadow:none !important; transform:none !important; }

@media (max-width: 480px) {
  .ep-control { min-height:40px; font-size:.84rem; }
  .ep-control:not(.ep-icon-control) { padding-inline:12px; }
}

/* Readable form controls across every dashboard page.  These selectors avoid
   checkboxes/radios and icon controls, so compact tools keep their size. */
main input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]),
main select,
main textarea {
  min-height: 42px;
  color: #10231d !important;
  background-color: #fff !important;
  border-color: rgba(6, 78, 59, .18) !important;
  border-radius: 10px !important;
  box-shadow: inset 0 1px 0 rgba(6, 78, 59, .02);
}
main textarea { min-height: 84px; }
/* The Net P&L input on the trade detail card sits inside a colored
   (green/red) card and must stay see-through; it opts out of the
   global white input fill above. */
/* The Net P&L input on the trade detail card sits inside a colored
   (green/red) card and must stay see-through; it opts out of the
   global white input fill above. Matches that rule's :not() clauses
   so specificity wins regardless of selector order. */
main input.trade-pnl-input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]) {
  background-color: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
  min-height: 0;
}
html.dark main input.trade-pnl-input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]) {
  background-color: transparent !important;
  border-color: transparent !important;
}

/* Strategy rule checklist buttons (Main Setup / Entry Model / Confirmations /
   Exit Model on journal.php and trade-detail.php): the checkbox + rule text
   must sit flush left, not centered, on every screen size. */
button:has(> .checklist-box) {
  justify-content: flex-start !important;
  text-align: left !important;
}
main input::placeholder, main textarea::placeholder { color:#6b7c75 !important; opacity:1; }
main label { color:#40524b; }
main .text-gray-400 { color:#64748b !important; }
html.dark main input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]),
html.dark main select,
html.dark main textarea { color:#ecfdf5 !important; background-color:#10271e !important; border-color:rgba(255,255,255,.14) !important; }
html.dark main label, html.dark main .text-gray-400 { color:#a8b8b1 !important; }

/* Common primary controls: one clear green action treatment without novelty shapes. */
button.bg-myfx-green, a.bg-myfx-green, .ep-btn-primary, .btn-primary, button[type="submit"] {
  border-radius: var(--ep-ui-radius);
}

/* Profile triggers and the Edge Agent launcher retain their purpose while using a stable square control.
   #chatFAB itself is sized to match the mobile nav bar's own button (see
   mobile-bottom-nav.css, #epBottomNavToggle) — kept at 46px here too so this
   later-loading, unscoped rule can't silently re-inflate it back past that
   on any breakpoint. Border is intentionally omitted (not just left at 0):
   mobile-bottom-nav.css already sets border:none !important on #chatFAB, and
   adding one here — even without !important — would show through on
   desktop widths, where that rule doesn't apply. */
#chatFAB, #chatToggle, #edgeAssistantToggle, [data-edge-assistant-toggle] {
  width: 46px !important;
  height: 46px !important;
  min-width: 46px;
  min-height: 46px;
  border-radius: 14px !important;
  box-shadow: 0 10px 24px -14px rgba(6,78,59,.7);
}
#chatToggle, #edgeAssistantToggle, [data-edge-assistant-toggle] {
  border: 1px solid rgba(255,255,255,.22);
}

/* First-paint drawer guard — mobile/tablet only.  On desktop the sidebar is
   a permanently fixed rail and must remain visible from the first paint;
   hiding it here caused it to appear to shift during refresh/loading. */
@media (max-width: 991.98px) {
  #edgepathSidebar, #mobileSidebarOverlay {
    visibility: hidden;
  }
  html.ep-shell-ready #edgepathSidebar,
  html.ep-shell-ready #mobileSidebarOverlay {
    visibility: visible;
  }
}

/* The header menu is a persistent, unambiguous sidebar control. */
#sidebarToggle {
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  color: #064e3b;
  background: #ffffff;
  border: 1px solid #d7e4df;
  border-radius: 10px !important;
  box-shadow: 0 3px 10px rgba(3, 47, 36, .08);
  transition: transform .2s ease, background-color .2s ease, color .2s ease, box-shadow .2s ease;
}
#sidebarToggle:hover {
  color: #ffffff;
  background: #064e3b;
  box-shadow: 0 7px 16px rgba(3, 47, 36, .18);
  transform: translateY(-1px);
}
#sidebarToggle:active { transform: translateY(0) scale(.96); }

/* Mobile compositor safety: use solid, stable layers instead of GPU-heavy
   blur/mask effects. This prevents the coloured stripe corruption seen while
   scrolling on affected phone and tablet browsers. */
@media (max-width: 991.98px) {
  .glass-panel {
    background: #ffffff !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
  }
  .epn-bottomnav::before {
    -webkit-mask-image: none !important;
    mask-image: none !important;
  }
  .mobile-wallet-pattern { display: none !important; }
  [class*="blur-"] { filter: none !important; }
  [style*="backdrop-filter"] {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
  }
}

/* Header profile links are controls too, not oversized avatar pills. */
header a[href="profile.php"], header a[href="../profile.php"] {
  min-height: 44px;
  border-radius: var(--ep-ui-radius) !important;
}

/* Menus size to content but cannot escape a narrow viewport. */
.ep-select-panel, [class*="dropdown-menu"], [class*="action-menu"], .trade-playbook-menu {
  max-width: min(360px, calc(100vw - 24px)) !important;
  max-height: min(360px, calc(100dvh - 24px)) !important;
  overscroll-behavior: contain;
}
.ep-select-option, [class*="dropdown-menu"] a, [class*="dropdown-menu"] button,
[class*="action-menu"] a, [class*="action-menu"] button {
  min-height: 40px;
}

/* Edge Agent sidebar stretches full height */
#chatPanel {
  max-width: min(450px, 100vw) !important;
  max-height: 100dvh !important;
  height: 100dvh !important;
  top: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  border-radius: 0;
  overflow: hidden;
}
#chatFAB {
  display: inline-grid !important;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--ep-ui-green), var(--ep-ui-green-2)) !important;
}
#chatBackdrop { background: rgba(2, 20, 14, .48); }

@media (max-width: 640px) {
  :root { --ep-ui-radius: 11px; }
  .epa-overlay, .ep-modal-bg, #subReminderPopup, #epAnnouncementPopup { padding-left: 16px !important; padding-right: 16px !important; }
  .epa-card { max-width: 100% !important; }
  #chatPanel { width: 100vw !important; max-width: none !important; }
  #chatPanel.maximized { width: 100vw !important; max-width: none !important; }
  .ep-select-panel { max-width: calc(100vw - 20px) !important; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* Authentication and landing-page loading states use the same skeleton
   language as the signed-in app.  This overrides the legacy ring loaders
   without changing authentication behaviour. */
#epPreloader .ep-load-card {
  width: min(320px, calc(100vw - 48px));
  min-height: 186px;
  gap: 0;
  padding: 28px !important;
  align-items: stretch;
  justify-content: flex-start;
  background: rgba(255,255,255,.07) !important;
}
#epPreloader .ep-spinner-container,
#epPreloader .ep-spinner { display: none !important; }
#epPreloader .ep-load-card::before,
#epPreloader .ep-load-card::after {
  content: '';
  display: block;
  border-radius: 10px;
  background: linear-gradient(90deg, rgba(255,255,255,.12), rgba(255,255,255,.25), rgba(255,255,255,.12));
  background-size: 220% 100%;
  animation: ep-skeleton-shimmer 1.35s ease-in-out infinite;
}
#epPreloader .ep-load-card::before { width: 48%; height: 18px; margin-bottom: 22px; }
#epPreloader .ep-load-card::after { width: 100%; height: 82px; }
#epPreloader .ep-load-text { display: none !important; }
@keyframes ep-skeleton-shimmer { to { background-position: -220% 0; } }
