/* Agenz Foundation V87 — cross-site form and search control audit */
:root {
  --af-control-ink: #102047;
  --af-control-copy: #52617d;
  --af-control-muted: #8793aa;
  --af-control-blue: #286ff2;
  --af-control-cyan: #19b9e6;
  --af-control-line: rgba(36, 77, 151, .23);
  --af-control-line-hover: rgba(40, 111, 242, .42);
  --af-control-shadow: 0 8px 22px rgba(35, 51, 105, .065);
  --af-control-focus: 0 0 0 3px rgba(40, 111, 242, .11), 0 12px 28px rgba(35, 51, 105, .09);
}

body :where(
  input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="image"]),
  textarea,
  select
) {
  color: var(--af-control-ink) !important;
  border-color: var(--af-control-line) !important;
  background-color: #fff !important;
  box-shadow: var(--af-control-shadow) !important;
  color-scheme: light !important;
  caret-color: var(--af-control-blue);
}

body :where(
  input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="image"]),
  textarea,
  select
):hover {
  border-color: var(--af-control-line-hover) !important;
}

body :where(
  input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="image"]),
  textarea,
  select
):focus {
  color: var(--af-control-ink) !important;
  border-color: var(--af-control-blue) !important;
  outline: 0 !important;
  background-color: #fff !important;
  box-shadow: var(--af-control-focus) !important;
}

body :where(input, textarea)::placeholder {
  color: var(--af-control-muted) !important;
  opacity: 1 !important;
}

body select option {
  color: var(--af-control-ink) !important;
  background: #fff !important;
}

body :where(input, textarea, select):-webkit-autofill,
body :where(input, textarea, select):-webkit-autofill:hover,
body :where(input, textarea, select):-webkit-autofill:focus {
  -webkit-text-fill-color: var(--af-control-ink) !important;
  -webkit-box-shadow: 0 0 0 1000px #fff inset !important;
  box-shadow: 0 0 0 1000px #fff inset !important;
  caret-color: var(--af-control-blue);
}

body input[type="search"] {
  appearance: none;
  -webkit-appearance: none;
}

body input[type="search"]::-webkit-search-cancel-button {
  opacity: .58;
}

body input[type="file"]::file-selector-button {
  margin-right: 12px;
  padding: 8px 11px;
  color: var(--af-control-blue);
  border: 1px solid rgba(40, 111, 242, .2);
  border-radius: 9px;
  background: #eef5ff;
  font: 800 .68rem Manrope, sans-serif;
  cursor: pointer;
}

body :where(input[type="checkbox"], input[type="radio"]) {
  accent-color: var(--af-control-blue);
  border-color: var(--af-control-line) !important;
  background-color: #fff !important;
  box-shadow: none !important;
  color-scheme: light !important;
}

/* Keep deliberately dark work areas coherent without letting V39 leak elsewhere. */
body:is(
  .brief-page,
  .order-page,
  .workspace-body,
  .dashboard-body,
  .social-profile-page,
  .workspace-page,
  .course-studio-page,
  .academy-classroom,
  .hub-page,
  .login-page
) :where(
  input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="image"]),
  textarea,
  select
) {
  color: #edf4ff !important;
  border-color: rgba(174, 200, 235, .2) !important;
  background-color: #0a1020 !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .025) !important;
  color-scheme: dark !important;
  caret-color: #67dff5;
}

body:is(
  .brief-page,
  .order-page,
  .workspace-body,
  .dashboard-body,
  .social-profile-page,
  .workspace-page,
  .course-studio-page,
  .academy-classroom,
  .hub-page,
  .login-page
) :where(input[type="checkbox"], input[type="radio"]) {
  border-color: rgba(174, 200, 235, .24) !important;
  background-color: #0a1020 !important;
  color-scheme: dark !important;
}

body:is(
  .brief-page,
  .order-page,
  .workspace-body,
  .dashboard-body,
  .social-profile-page,
  .workspace-page,
  .course-studio-page,
  .academy-classroom,
  .hub-page,
  .login-page
) :where(
  input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="image"]),
  textarea,
  select
):focus {
  color: #fff !important;
  border-color: #67dff5 !important;
  background-color: #0a1020 !important;
  box-shadow: 0 0 0 3px rgba(103, 223, 245, .1), 0 12px 28px rgba(0, 0, 0, .2) !important;
}

body:is(
  .brief-page,
  .order-page,
  .workspace-body,
  .dashboard-body,
  .social-profile-page,
  .workspace-page,
  .course-studio-page,
  .academy-classroom,
  .hub-page,
  .login-page
) :where(input, textarea)::placeholder {
  color: #8d9ab1 !important;
}

body:is(
  .brief-page,
  .order-page,
  .workspace-body,
  .dashboard-body,
  .social-profile-page,
  .workspace-page,
  .course-studio-page,
  .academy-classroom,
  .hub-page,
  .login-page
) select option {
  color: #edf4ff !important;
  background: #0a1020 !important;
}

body:is(
  .brief-page,
  .order-page,
  .workspace-body,
  .dashboard-body,
  .social-profile-page,
  .workspace-page,
  .course-studio-page,
  .academy-classroom,
  .hub-page,
  .login-page
) :where(input, textarea, select):-webkit-autofill,
body:is(
  .brief-page,
  .order-page,
  .workspace-body,
  .dashboard-body,
  .social-profile-page,
  .workspace-page,
  .course-studio-page,
  .academy-classroom,
  .hub-page,
  .login-page
) :where(input, textarea, select):-webkit-autofill:hover,
body:is(
  .brief-page,
  .order-page,
  .workspace-body,
  .dashboard-body,
  .social-profile-page,
  .workspace-page,
  .course-studio-page,
  .academy-classroom,
  .hub-page,
  .login-page
) :where(input, textarea, select):-webkit-autofill:focus {
  -webkit-text-fill-color: #edf4ff !important;
  -webkit-box-shadow: 0 0 0 1000px #0a1020 inset !important;
  box-shadow: 0 0 0 1000px #0a1020 inset !important;
}

/* Search shells own their outer border; the nested field must stay transparent. */
:where(
  .insights-discovery-controls label,
  .library-search-box,
  .username-field,
  .ai-input-shell
) > :where(input, textarea) {
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

:where(
  .insights-discovery-controls label,
  .library-search-box,
  .username-field,
  .ai-input-shell
):focus-within {
  border-color: var(--af-control-blue) !important;
  box-shadow: var(--af-control-focus) !important;
}

/* Dark overlays can live inside otherwise light pages; keep their controls legible. */
:where(.ai-chat, .companion-panel, .mentor-panel) :where(
  input:not([type="hidden"]),
  textarea,
  select
) {
  color: #edf4ff !important;
  border-color: rgba(174, 200, 235, .2) !important;
  background-color: #0a1020 !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .025) !important;
  color-scheme: dark !important;
  caret-color: #67dff5;
}

:where(.ai-chat, .companion-panel, .mentor-panel) :where(input, textarea)::placeholder {
  color: #8d9ab1 !important;
}

:where(.ai-chat, .companion-panel, .mentor-panel) .ai-input-shell > :where(input, textarea) {
  color: #edf4ff !important;
  background: transparent !important;
  box-shadow: none !important;
}

@media (max-width: 640px) {
  :where(.insights-discovery, .library-discovery, .library-search-box) kbd {
    display: none !important;
  }
}
