/* Screen surfaces must not override the base theme's invoice paper styles. */
@media screen {
/* Brand form controls stay separate from the base theme so component-specific controls retain their contract. */

/* ================================================================== */
/* 1. Text fields, selects, textareas                                  */
/* ================================================================== */

html[data-snx-takeover] body.snx-portal :is(.form-control, .custom-select, .custom-file-label),
html[data-snx-takeover] body.snx-portal .select2-container--default :is(.select2-selection--single, .select2-selection--multiple) {
  border: 1px solid var(--snx-field-line);
  border-radius: var(--snx-radius-sm);
  background-color: var(--snx-field-bg, var(--snx-card));
  color: var(--snx-text-dark);
  font-family: var(--snx-font);
  box-shadow: none;
}
:where(html[data-snx-takeover]) body.snx-portal textarea.form-control:not([rows]) { height: auto; min-height: 120px; padding: 10px 14px; line-height: 1.55; resize: vertical; }

/* Selects draw their chevron in the field's own ink (two gradient triangles), so it follows every brand and scheme;
   stock's data-URI arrow is a fixed #343a40 that disappears on dark fields. */
:where(html[data-snx-takeover]) body.snx-portal :is(.custom-select, select.form-control:not([multiple]):not([size])) {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 38px;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}
:where(html[data-snx-takeover]) body.snx-portal select.form-control option { background-color: var(--snx-field-bg, var(--snx-card)); color: var(--snx-text-dark); }

:where(html[data-snx-takeover]) body.snx-portal :is(.form-control, .custom-select):hover:not(:disabled):not([readonly]):not(:focus) { border-color: var(--snx-text-muted); }

/* One focus treatment for every field: the brand focus colour as border and ring (the ring is the portal's
   :focus-visible outline, pulled in to 1px so it hugs the field). */
html[data-snx-takeover] body.snx-portal :is(.form-control, .custom-select):focus {
  border-color: var(--snx-focus);
  background-color: var(--snx-field-bg, var(--snx-card));
  color: var(--snx-text-dark);
  box-shadow: none;
  outline: 2px solid var(--snx-focus);
  outline-offset: 1px;
}
:where(html[data-snx-takeover]) body.snx-portal .select2-container--default.select2-container--focus .select2-selection,
:where(html[data-snx-takeover]) body.snx-portal .select2-container--default.select2-container--open .select2-selection { border-color: var(--snx-focus); outline: 2px solid var(--snx-focus); outline-offset: 1px; }

:where(html[data-snx-takeover]) body.snx-portal .form-control::placeholder { color: var(--snx-text-muted); opacity: 1; }
:where(html[data-snx-takeover]) body.snx-portal :is(.form-control, .custom-select):disabled { border-style: dashed; background-color: var(--snx-tint); color: var(--snx-text-muted); cursor: not-allowed; }
:where(html[data-snx-takeover]) body.snx-portal .form-control[readonly] { background-color: var(--snx-card-subtle); color: var(--snx-text-dark); }

/* Browser autofill paints its own pale fill; keep the field's ink and use the brand tint instead. */
:where(html[data-snx-takeover]) body.snx-portal .form-control:-webkit-autofill,
:where(html[data-snx-takeover]) body.snx-portal .form-control:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--snx-text-dark);
  caret-color: var(--snx-text-dark);
  box-shadow: inset 0 0 0 100px var(--snx-tint);
}

/* select2 (searchable selects on ticket and billing pages) */
:where(html[data-snx-takeover]) body.snx-portal .select2-container--default .select2-selection--single .select2-selection__rendered { color: var(--snx-text-dark); }
:where(html[data-snx-takeover]) body.snx-portal .select2-container--default .select2-selection--single .select2-selection__placeholder { color: var(--snx-text-muted); }
:where(html[data-snx-takeover]) body.snx-portal .select2-container--default .select2-selection--single .select2-selection__arrow b { border-top-color: var(--snx-text-dark); }
:where(html[data-snx-takeover]) body.snx-portal .select2-dropdown { border-color: var(--snx-field-line); background: var(--snx-card); color: var(--snx-text-dark); }
:where(html[data-snx-takeover]) body.snx-portal .select2-search--dropdown .select2-search__field { border: 1px solid var(--snx-field-line); border-radius: var(--snx-radius-sm); background: var(--snx-field-bg, var(--snx-card)); color: var(--snx-text-dark); }
:where(html[data-snx-takeover]) body.snx-portal .select2-container--default .select2-results__option--highlighted[aria-selected] { background: var(--snx-field-check, var(--snx-purple)); color: var(--snx-field-check-ink, #ffffff); }
:where(html[data-snx-takeover]) body.snx-portal .select2-container--default .select2-results__option[aria-selected="true"] { background: var(--snx-tint); color: var(--snx-text-dark); }

/* ================================================================== */
/* 2. Labels, help, validation                                         */
/* ================================================================== */

:where(html[data-snx-takeover]) body.snx-portal :where(label, .col-form-label, legend.col-form-label) { color: var(--snx-text-dark); font-weight: 600; }
:where(html[data-snx-takeover]) body.snx-portal :is(label .required, label .text-danger, .snx-required) { color: var(--snx-bad); }
:where(html[data-snx-takeover]) body.snx-portal :is(.form-text, .help-block, .snx-acct-help, small.text-muted) { color: var(--snx-text-muted) !important; font-size: 0.8rem; }

/* Invalid: red border plus a 3px inner bar, so the state never rests on hue alone. Stock (parsley) paints a pink fill
   and pale border that fail on dark surfaces; the field keeps its own surface instead. */
html[data-snx-takeover] body.snx-portal :is(.form-control, .custom-select):is(.is-invalid, .parsley-error, [aria-invalid="true"]),
html[data-snx-takeover] body.snx-portal :is(input, select, textarea).parsley-error {
  border-color: var(--snx-bad);
  background-color: var(--snx-field-bg, var(--snx-card));
  color: var(--snx-text-dark);
  box-shadow: inset 3px 0 0 var(--snx-bad);
}
html[data-snx-takeover] body.snx-portal :is(.form-control, .custom-select):is(.is-invalid, .parsley-error, [aria-invalid="true"]):focus { border-color: var(--snx-bad); outline-color: var(--snx-bad); }
:where(html[data-snx-takeover]) body.snx-portal :is(.form-control, .custom-select).is-valid { border-color: var(--snx-ok); }
:where(html[data-snx-takeover]) body.snx-portal :is(.invalid-feedback, .parsley-errors-list) { margin: 0; padding: 0; color: var(--snx-bad); font-size: 0.82rem; font-weight: 600; line-height: 1.4; list-style: none; }
:where(html[data-snx-takeover]) body.snx-portal .parsley-errors-list:not(.filled) { display: none; }
:where(html[data-snx-takeover]) body.snx-portal .parsley-errors-list.filled { opacity: 1; }
:where(html[data-snx-takeover]) body.snx-portal .invalid-feedback { margin-top: 4px; }
:where(html[data-snx-takeover]) body.snx-portal .valid-feedback { color: var(--snx-ok); font-weight: 600; }

/* ================================================================== */
/* 3. Checkboxes, radios, switches                                     */
/* ================================================================== */

/* Native boxes take the brand as their accent; the browser picks a check colour that contrasts with it. */
:where(html[data-snx-takeover]) body.snx-portal input:is([type="checkbox"], [type="radio"]):not(.snx-svc-switch):not(.custom-control-input) { accent-color: var(--snx-field-check, var(--snx-purple)); }
:where(html[data-snx-takeover]) body.snx-portal input:is([type="checkbox"], [type="radio"]):focus-visible { outline: 2px solid var(--snx-focus); outline-offset: 2px; }

/* Stock checkout draws payment dots on labels, independently of the hidden native radios. */
html[data-snx-takeover] body.snx-portal .payment-method .select-payment label::before {
  border: 1px solid var(--snx-field-line);
  background: var(--snx-field-bg, var(--snx-card));
  box-shadow: none;
}
html[data-snx-takeover] body.snx-portal .payment-method .select-payment label::after { background: var(--snx-text-muted); }
html[data-snx-takeover] body.snx-portal .payment-method .select-payment label.selected { background: var(--snx-card-subtle); }
html[data-snx-takeover] body.snx-portal .payment-method .select-payment label.selected::before { border-color: var(--snx-field-check, var(--snx-purple)); background: var(--snx-field-check, var(--snx-purple)); }
html[data-snx-takeover] body.snx-portal .payment-method .select-payment label.selected::after { background: var(--snx-field-check-ink, #ffffff); }
html[data-snx-takeover] body.snx-portal .payment-method .select-payment label:has(.payment-option:focus-visible)::before { outline: 2px solid var(--snx-focus); outline-offset: 2px; }

/* Confirmation dialogs take the same primary fill and ink as every other brand button: VPSTitan's near-black ink
   fails on the solid --snx-purple that sheernox.css gives them. */
html[data-snx-takeover] body.snx-portal .jconfirm .jconfirm-box .jconfirm-buttons button.btn-primary { background: var(--snx-btn-fill, var(--snx-aurora)); color: var(--snx-btn-fill-ink, var(--snx-btn-ink, #ffffff)); }
html[data-snx-takeover] body.snx-portal .jconfirm .jconfirm-box .jconfirm-buttons button.btn-primary:hover { background: var(--snx-btn-fill-hover, var(--snx-aurora-hover, var(--snx-aurora))); color: var(--snx-btn-fill-ink, var(--snx-btn-ink, #ffffff)); }

/* Radio and checkbox cards (payment method, billing options) */
:where(html[data-snx-takeover]) body.snx-portal .snx-bill-option:hover { border-color: var(--snx-text-muted); }
:where(html[data-snx-takeover]) body.snx-portal .snx-bill-option:has(input:checked) {
  border-color: var(--snx-field-check, var(--snx-purple));
  background: var(--snx-card-subtle);
  box-shadow: inset 0 0 0 1px var(--snx-field-check, var(--snx-purple));
}

/* Portal toggle switch (.snx-svc-switch): the off track keeps a 3:1 outline and a muted knob, on is the brand. */
:where(html[data-snx-takeover]) body.snx-portal .snx-svc-switch { border-color: var(--snx-field-line); background: var(--snx-tint); }
:where(html[data-snx-takeover]) body.snx-portal .snx-svc-switch:checked { border-color: transparent; background: var(--snx-field-check, var(--snx-purple)); }
:where(html[data-snx-takeover]) body.snx-portal .snx-svc-switch:checked::after { background: var(--snx-field-check-ink, var(--snx-card)); }
:where(html[data-snx-takeover]) body.snx-portal .snx-svc-switch:focus-visible { outline: 2px solid var(--snx-focus); outline-offset: 2px; }

/* Bootstrap custom controls. The check and dot are masks filled with the check ink, so they flip to dark ink on the
   light brand fills of VPSTitan and HostBlizzard dark. */
:where(html[data-snx-takeover]) body.snx-portal .custom-control-label::before { border: 1px solid var(--snx-field-line); background-color: var(--snx-field-bg, var(--snx-card)); }
:where(html[data-snx-takeover]) body.snx-portal .custom-control-input:checked ~ .custom-control-label::before,
:where(html[data-snx-takeover]) body.snx-portal .custom-control-input:indeterminate ~ .custom-control-label::before { border-color: var(--snx-field-check, var(--snx-purple)); background-color: var(--snx-field-check, var(--snx-purple)); }
:where(html[data-snx-takeover]) body.snx-portal .custom-control-input:focus ~ .custom-control-label::before { box-shadow: none; }
:where(html[data-snx-takeover]) body.snx-portal .custom-control-input:focus-visible ~ .custom-control-label::before { outline: 2px solid var(--snx-focus); outline-offset: 2px; }
:where(html[data-snx-takeover]) body.snx-portal .custom-control-input:disabled ~ .custom-control-label::before { border-style: dashed; background-color: var(--snx-tint); }
:where(html[data-snx-takeover]) body.snx-portal :is(.custom-checkbox, .custom-radio) .custom-control-input:checked ~ .custom-control-label::after {
  background: var(--snx-field-check-ink, #ffffff);
  -webkit-mask: var(--snx-field-mark) center / 70% no-repeat;
  mask: var(--snx-field-mark) center / 70% no-repeat;
}
:where(html[data-snx-takeover]) body.snx-portal .custom-checkbox { --snx-field-mark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3E%3Cpath d='M6.6 1.1 3 4.7 1.4 3.1 0 4.5l3 3 5-5z'/%3E%3C/svg%3E"); }
:where(html[data-snx-takeover]) body.snx-portal .custom-radio { --snx-field-mark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3E%3Ccircle r='2.4'/%3E%3C/svg%3E"); }
:where(html[data-snx-takeover]) body.snx-portal .custom-switch .custom-control-label::after { background-color: var(--snx-text-muted); }
:where(html[data-snx-takeover]) body.snx-portal .custom-switch .custom-control-input:checked ~ .custom-control-label::after { background-color: var(--snx-field-check-ink, #ffffff); }

/* ================================================================== */
/* 4. Input groups and file inputs                                     */
/* ================================================================== */

:where(html[data-snx-takeover]) body.snx-portal .input-group-text { border-color: var(--snx-field-line); background: var(--snx-card-subtle); color: var(--snx-text-muted); font-weight: 600; }
/* sheernox.css rounds every .form-control, which also rounds the joined edges inside a group; square them again. */
:where(html[data-snx-takeover]) body.snx-portal .input-group > :is(.form-control, .custom-select):not(:last-child),
:where(html[data-snx-takeover]) body.snx-portal .input-group > .input-group-prepend > :is(.input-group-text, .btn) { border-top-right-radius: 0; border-bottom-right-radius: 0; }
:where(html[data-snx-takeover]) body.snx-portal .input-group > :is(.form-control, .custom-select):not(:first-child),
:where(html[data-snx-takeover]) body.snx-portal .input-group > .input-group-append > :is(.input-group-text, .btn) { border-top-left-radius: 0; border-bottom-left-radius: 0; }
:where(html[data-snx-takeover]) body.snx-portal .input-group > .input-group-prepend > .input-group-text { border-radius: var(--snx-radius-sm) 0 0 var(--snx-radius-sm); }
:where(html[data-snx-takeover]) body.snx-portal .input-group > .input-group-append > :is(.input-group-text, .btn) { border-radius: 0 var(--snx-radius-sm) var(--snx-radius-sm) 0; }
:where(html[data-snx-takeover]) body.snx-portal .input-group > :is(.form-control, .custom-select):focus { z-index: 3; }

:where(html[data-snx-takeover]) body.snx-portal input[type="file"] { color: var(--snx-text-body); }
:where(html[data-snx-takeover]) body.snx-portal input[type="file"]::file-selector-button {
  margin-right: 12px;
  padding: 7px 16px;
  border: 1px solid var(--snx-field-line);
  border-radius: 9999px;
  background: var(--snx-card);
  color: var(--snx-text-dark);
  font: 700 0.8rem/1.2 var(--snx-font);
  cursor: pointer;
}
:where(html[data-snx-takeover]) body.snx-portal input[type="file"]:hover::file-selector-button { border-color: var(--snx-violet); color: var(--snx-link); }
:where(html[data-snx-takeover]) body.snx-portal .custom-file-label::after { border-left-color: var(--snx-field-line); background: var(--snx-tint); color: var(--snx-text-dark); }

/* ================================================================== */
/* 5. Buttons                                                          */
/* ================================================================== */

:where(html[data-snx-takeover]) body.snx-portal :is(.btn, .snx-bill-btn, .app-btns) { font-family: var(--snx-font); }
:where(html[data-snx-takeover]) body.snx-portal :is(.btn, .snx-bill-btn, .app-btns):focus { box-shadow: none; }
:where(html[data-snx-takeover]) body.snx-portal :is(.btn, .snx-bill-btn, .app-btns):focus-visible { outline: 2px solid var(--snx-focus); outline-offset: 2px; }
:where(html[data-snx-takeover]) body.snx-portal :is(.btn, .snx-bill-btn):is(:disabled, .disabled) { opacity: 0.55; filter: none; box-shadow: none; }

/* Primary: the brand fill with its own ink (VPSTitan's molten fill needs near-black ink, the others white). */
:where(html[data-snx-takeover]) body.snx-portal :is(.snx-bill-btn--primary, .btn-primary, .app-btns.primary),
:where(html[data-snx-takeover]) body.snx-portal .btn-primary:not(:disabled):not(.disabled):active {
  border-color: transparent;
  background: var(--snx-btn-fill, var(--snx-aurora));
  color: var(--snx-btn-fill-ink, var(--snx-btn-ink, #ffffff));
  box-shadow: var(--snx-btn-fill-shadow, var(--snx-btn-shadow, none));
}
:where(html[data-snx-takeover]) body.snx-portal :is(.snx-bill-btn--primary, .btn-primary, .app-btns.primary):hover {
  border-color: transparent;
  background: var(--snx-btn-fill-hover, var(--snx-aurora-hover, var(--snx-aurora)));
  color: var(--snx-btn-fill-ink, var(--snx-btn-ink, #ffffff));
  filter: brightness(1.05);
}
:where(html[data-snx-takeover]) body.snx-portal :is(.snx-bill-btn--primary, .btn-primary):focus-visible { outline-color: var(--snx-focus); }

/* The existing-customer link is a stock alert rather than a primary button. */
html[data-snx-takeover] body.snx-portal .info-bar .already-registered-btn { background: var(--snx-aurora); color: var(--snx-btn-ink); }
html[data-snx-takeover] body.snx-portal .info-bar .already-registered-btn a { color: inherit; }
html[data-snx-takeover] body.snx-portal .info-bar .already-registered-btn a:focus-visible { outline: 2px solid var(--snx-focus); outline-offset: 2px; }

/* Secondary: .snx-bill-btn's default already reads the brand tokens in sheernox.css; Bootstrap's default and stock
   .app-btns.secondary get the same card look. */
:where(html[data-snx-takeover]) body.snx-portal :is(.btn-default, .app-btns.secondary) { border: 1px solid var(--snx-input-border); background: var(--snx-card); color: var(--snx-text-dark); }
:where(html[data-snx-takeover]) body.snx-portal :is(.btn-default, .app-btns.secondary):hover { border-color: var(--snx-violet); color: var(--snx-link); }

/* Outline: brand.css's outline tokens, falling back to the base Sheernox purple. */
:where(html[data-snx-takeover]) body.snx-portal :is(.btn-outline-primary, .btn-outline-secondary) {
  border-color: var(--snx-btn-outline-line, var(--snx-purple));
  background: transparent;
  color: var(--snx-btn-outline-ink, var(--snx-link));
}
:where(html[data-snx-takeover]) body.snx-portal :is(.btn-outline-primary, .btn-outline-secondary):hover {
  border-color: var(--snx-btn-outline-hover-bg, var(--snx-purple));
  background: var(--snx-btn-outline-hover-bg, var(--snx-purple));
  color: var(--snx-btn-outline-hover-ink, #ffffff);
}

/* Ghost and link: text in the link colour, underlined on hover so they read as actions without a fill. */
:where(html[data-snx-takeover]) body.snx-portal :is(.snx-bill-btn--ghost, .btn-link) { border-color: transparent; background: transparent; color: var(--snx-link); box-shadow: none; }
:where(html[data-snx-takeover]) body.snx-portal :is(.snx-bill-btn--ghost, .btn-link):hover { color: var(--snx-link-hover); text-decoration: underline; text-underline-offset: 3px; }

@media (prefers-reduced-motion: reduce) {
  :where(html[data-snx-takeover]) body.snx-portal :is(.btn, .snx-bill-btn, .form-control) { transition: none; }
}

/* The billing search is a field even though stock does not give it .form-control. */
html[data-snx-takeover] body.snx-portal .snx-bill-search input { border-color: var(--snx-field-line); background-color: var(--snx-field-bg, var(--snx-card)); }

/* Sheernox keeps its existing field states and focus ring; only idle field outlines become darker. */
html[data-snx-brand="sheernox"] body.snx-portal :is(.form-control, .custom-select, .custom-file-label):where(:not(:focus):not(.is-invalid):not(.is-valid):not(.parsley-error):not([aria-invalid="true"])),
html[data-snx-brand="sheernox"] body.snx-portal .select2-container--default:where(:not(.select2-container--focus):not(.select2-container--open)) :is(.select2-selection--single, .select2-selection--multiple),
html[data-snx-brand="sheernox"] body.snx-portal .snx-bill-search input:where(:not(:focus)) { border-color: var(--snx-field-line); }

/* Fill changes stay at base selector weight so existing hero button treatments still win. */
:where(html[data-snx-brand="sheernox"]) body.snx-portal :is(.btn-primary, .snx-bill-btn--primary),
:where(html[data-snx-brand="sheernox"]) body.snx-portal .app-btns.primary { background: var(--snx-btn-fill); }
:where(html[data-snx-brand="sheernox"]) body.snx-portal :is(.btn-primary, .snx-bill-btn--primary):hover,
:where(html[data-snx-brand="sheernox"]) body.snx-portal .app-btns.primary:hover { background: var(--snx-btn-fill-hover); }
}
