/* ESFX V76 — Dark UI precision pass. Load after theme-v75.css.
   Production principle: only dark-mode components, plus mobile theme-button geometry
   that must match neighboring appbar buttons in both themes. */

/* A. Form controls: one boundary per control. Design tokens are specific to Dark Mode. */
html[data-esfx-theme="dark"] {
  --esfx-field-bg: #2d3c46;
  --esfx-field-border: #465863;
  --esfx-field-hover: #627780;
  --esfx-field-ring: rgba(46,191,137,.16);
  --esfx-field-text: #e8eff1;
  --esfx-field-placeholder: #a8b9c0;
}
html[data-esfx-theme="dark"] :is(
  .market-search-box,.field-with-icon,.people-search-input,.profile-username-input,
  .messenger-search,.search-field,.search-control,.filter-search-box,
  .chat-compose-row textarea,.tool-form-grid input,.tool-form-grid select,
  .tools-market-select-row select,.signal-generator-form input,.signal-generator-form select,
  .calendar-filter-grid input,.calendar-filter-grid select,
  .form-control,.form-input,.search-input,
  input:is(:not([type]),[type="text"],[type="email"],[type="password"],[type="number"],[type="search"],[type="url"],[type="tel"],[type="date"],[type="time"],[type="datetime-local"],[type="month"],[type="week"]),
  select,textarea
) {
  border-radius: 11px!important;
  border: 1px solid var(--esfx-field-border)!important;
  background-color: var(--esfx-field-bg)!important;
  color: var(--esfx-field-text)!important;
  box-shadow: none!important;
  outline: none!important;
}
html[data-esfx-theme="dark"] :is(input,textarea)::placeholder {
  color:var(--esfx-field-placeholder)!important;
  opacity:1;
}
/* Only the outer wrapper gets border/focus visuals; inner inputs are always borderless.
   This fixes doubled borders in People Search, Markets and other icon inputs. */
html[data-esfx-theme="dark"] :is(
 .market-search-box,.field-with-icon,.people-search-input,.profile-username-input,
 .messenger-search,.search-field,.search-control,.filter-search-box
) :is(input,textarea,select),
html[data-esfx-theme="dark"] :is(
 .market-search-box,.field-with-icon,.people-search-input,.profile-username-input,
 .messenger-search,.search-field,.search-control,.filter-search-box
) :is(input,textarea,select):focus,
html[data-esfx-theme="dark"] :is(
 .market-search-box,.field-with-icon,.people-search-input,.profile-username-input,
 .messenger-search,.search-field,.search-control,.filter-search-box
) :is(input,textarea,select):focus-visible {
  background: transparent!important;
  color:var(--esfx-field-text)!important;
  border:0!important;
  border-radius:0!important;
  box-shadow:none!important;
  outline:none!important;
  outline-offset:0!important;
}
html[data-esfx-theme="dark"] :is(
 .market-search-box,.field-with-icon,.people-search-input,.profile-username-input,
 .messenger-search,.search-field,.search-control,.filter-search-box
):focus-within {
  border:1px solid #51b28c!important;
  outline:none!important;
  box-shadow:0 0 0 2px var(--esfx-field-ring)!important;
}
/* Standalone controls get the same subtle ring. No neon 2px outline plus extra shadow. */
html[data-esfx-theme="dark"] :is(
 .chat-compose-row textarea,.form-control,.form-input,.search-input,
 .signal-generator-form select,.signal-generator-form input,
 .calendar-filter-grid input,.calendar-filter-grid select,
 .tool-form-grid input,.tool-form-grid select,
 input:is(:not([type]),[type="text"],[type="email"],[type="password"],[type="number"],[type="search"],[type="url"],[type="tel"],[type="date"],[type="time"],[type="datetime-local"],[type="month"],[type="week"]),
 select,textarea
):focus-visible,
html[data-esfx-theme="dark"] :is(input,textarea,select):focus {
  outline:none!important;
  border-color:#51b28c!important;
  box-shadow:0 0 0 2px var(--esfx-field-ring)!important;
}
/* Do not style behind-the-scenes upload input, OAuth widgets, range controls. */
html[data-esfx-theme="dark"] :is(.chat-media-submit-input,.chat-media-picker-input,input[type="file"]){
  border:0!important;box-shadow:none!important;outline:none!important;
}
html[data-esfx-theme="dark"] input[type="date"] {color-scheme:dark}
html[data-esfx-theme="dark"] :is(.market-search-box,.field-with-icon,.people-search-input,.messenger-search) {
  min-width:0;
}
html[data-esfx-theme="dark"] :is(.market-search-box,.field-with-icon,.people-search-input,.messenger-search) :is(input,textarea) {
  min-width:0;min-height:0;
}

/* B. Messenger: reset the gradient rather than only background-color. */
html[data-esfx-theme="dark"] :is(.messenger-shell,.messenger-main,.messenger-sidebar){
  border-color:#42515b!important;
}
html[data-esfx-theme="dark"] .messenger-main {
  background:#26313a!important;
}
html[data-esfx-theme="dark"] .chat-thread,
html[data-esfx-theme="dark"] .messenger-main .chat-thread {
  background:#1c2831!important;
  background-image:none!important;
  color:#dce7eb!important;
  border:0!important;
  scrollbar-color:#4b5d67 #1c2831;
}
html[data-esfx-theme="dark"] .chat-head {
  background:#25343e!important;
  border-bottom:1px solid #43545f!important;
  color:#ecf4f5!important;
}
html[data-esfx-theme="dark"] .chat-head :is(.chat-profile-link,.chat-user-copy strong){
  color:#eaf2f3!important;
}
html[data-esfx-theme="dark"] .chat-head .icon-button {
  background:#33434d!important;
  border:1px solid #475965!important;
  color:#e1ebed!important;
}
html[data-esfx-theme="dark"] .chat-head .icon-button:hover {
  background:#3e505b!important;
}
html[data-esfx-theme="dark"] .chat-compose {
  background:#26343d!important;
  border-top:1px solid #44535e!important;
  color:#e8eff0!important;
}
html[data-esfx-theme="dark"] .chat-compose-row{min-width:0;align-items:center}
html[data-esfx-theme="dark"] .chat-compose-row textarea {
  width:100%;min-width:0;max-width:100%;
  background:#2f404a!important;
  border:1px solid #4a5b65!important;
  color:#e9f0f2!important;
  box-shadow:none!important;
  border-radius:12px!important;
}
html[data-esfx-theme="dark"] .chat-compose-row textarea:focus,
html[data-esfx-theme="dark"] .chat-compose-row textarea:focus-visible {
  border-color:#55bd93!important;
  box-shadow:0 0 0 2px rgba(46,191,137,.16)!important;
}
html[data-esfx-theme="dark"] .chat-attach {
  background:#33434d!important;
  border:1px solid #485a65!important;
  color:#d7e6e9!important;
  border-radius:12px!important;
}
html[data-esfx-theme="dark"] .chat-send {
  background:#17966a!important;
  border:1px solid #2ba777!important;
  color:#fff!important;
  border-radius:12px!important;
  box-shadow:none!important;
}
html[data-esfx-theme="dark"] .chat-send:hover:not(:disabled){background:#1ba875!important}
html[data-esfx-theme="dark"] .chat-send:disabled,
html[data-esfx-theme="dark"] .chat-send[aria-disabled="true"] {
  background:#35544a!important;
  border-color:#436557!important;
  color:#b6d8c7!important;
  opacity:1!important;
  cursor:not-allowed;
}
html[data-esfx-theme="dark"] .message-bubble.theirs .message-content,
html[data-esfx-theme="dark"] .message-content {
  background:#344650!important;
  border:1px solid #4a5b65!important;
  color:#e8eff0!important;
  box-shadow:none!important;
}
html[data-esfx-theme="dark"] .message-bubble.mine .message-content {
  background:#1f7657!important;
  border-color:#2b9270!important;
  color:#f7fffb!important;
}
html[data-esfx-theme="dark"] .message-bubble :is(footer,time,.message-status-icon){color:#a9bac2!important}
html[data-esfx-theme="dark"] .message-bubble.mine .message-status-icon{color:#9af4c9!important}
html[data-esfx-theme="dark"] .chat-blocked-note {
  background:#2b3b45!important;
  border-top:1px solid #475965!important;
}
html[data-esfx-theme="dark"] .chat-media-preview,
html[data-esfx-theme="dark"] .chat-media-preview-thumb,
html[data-esfx-theme="dark"] .chat-media-sheet-card {
  background:#2e3d47!important;border-color:#4b5c66!important;
  color:#e8eff1!important;
}
html[data-esfx-theme="dark"] .chat-thread.is-loading-older:before {background:#1c2831!important}
@media(max-width:700px){
 html[data-esfx-theme="dark"] .esfx-product-body:has(.messenger-shell .chat-head) .chat-head,
 html[data-esfx-theme="dark"] body.esfx-chat-conversation .chat-head {
   background:#25343e!important;
 }
}

/* C. Uniform mobile AppBar action icons. All adjacent buttons share a 38px hit area. */
@media(max-width:860px){
 .site-header .header-actions > .esfx-theme-toggle-header,
 .site-header .header-actions > .appbar-icon-link,
 .site-header .header-actions > .nav-toggle.icon-button {
   box-sizing:border-box!important;
   width:38px!important;min-width:38px!important;max-width:38px!important;
   height:38px!important;min-height:38px!important;max-height:38px!important;
   padding:0!important;border-radius:12px!important;
   display:inline-grid!important;place-items:center!important;flex:0 0 38px!important;
 }
 .site-header .header-actions>.esfx-theme-toggle-header .ui-icon,
 .site-header .header-actions>.appbar-icon-link .appbar-icon {
   width:18px!important;height:18px!important;
 }
 body.esfx-native-app .esfx-native-header .esfx-theme-toggle-native,
 body.esfx-native-app .esfx-native-header .esfx-native-icon-link,
 body.esfx-native-app .esfx-native-header .esfx-native-menu-toggle {
   box-sizing:border-box!important;
   width:38px!important;min-width:38px!important;max-width:38px!important;
   height:38px!important;min-height:38px!important;max-height:38px!important;
   padding:0!important;border-radius:12px!important;
   display:inline-grid!important;place-items:center!important;flex:0 0 38px!important;
 }
 body.esfx-native-app .esfx-native-header .esfx-theme-toggle-native .ui-icon,
 body.esfx-native-app .esfx-native-header .esfx-native-icon-link .appbar-icon {
   width:18px!important;height:18px!important;
 }
}
@media(max-width:375px){
 /* Keep 38px tap targets, compress gaps instead of shrinking the theme button alone. */
 .site-header .header-actions{gap:3px!important}
 body.esfx-native-app .esfx-native-header-actions{gap:2px!important}
}

/* V76 specificity guard: V72 contains a high-specificity generic input selector
   and a global focus-visible rule. Composite inputs must win against BOTH. */
html[data-esfx-theme="dark"] body :is(
 .market-search-box,.field-with-icon,.people-search-input,.profile-username-input,
 .messenger-search,.search-field,.search-control,.filter-search-box
) :is(input,textarea,select),
html[data-esfx-theme="dark"] body :is(
 .market-search-box,.field-with-icon,.people-search-input,.profile-username-input,
 .messenger-search,.search-field,.search-control,.filter-search-box
) :is(input,textarea,select):focus,
html[data-esfx-theme="dark"] body :is(
 .market-search-box,.field-with-icon,.people-search-input,.profile-username-input,
 .messenger-search,.search-field,.search-control,.filter-search-box
) :is(input,textarea,select):focus-visible {
  border:0!important;
  border-radius:0!important;
  outline:none!important;
  box-shadow:none!important;
  background:transparent!important;
  color:var(--esfx-field-text)!important;
}
html[data-esfx-theme="dark"] body :is(
 .market-search-box,.field-with-icon,.people-search-input,.profile-username-input,
 .messenger-search,.search-field,.search-control,.filter-search-box
):focus-within {
  border:1px solid #51b28c!important;
  outline:none!important;
  box-shadow:0 0 0 2px var(--esfx-field-ring)!important;
}
html[data-esfx-theme="dark"] body .chat-compose {
  background:#26343d!important;
  background-image:none!important;
  border-top-color:#44535e!important;
}
