/* Match the public MK3Node palette across the client portal. */
:root {
    --site-page: #fafbfc;
    --site-band: #edf1f5;
    --site-card: #ffffff;
    --site-field: #ffffff;
    --site-ink: #172235;
    --site-muted: #465568;
    --site-line: #cbd3dd;
    --site-control-line: #8796aa;
    --site-header: #ffffff;
    --site-link: #17634f;
    --site-action: #65c3a1;
    --site-on-action: #15171e;
}

html:is([data-mk3-theme="dark"], [data-mk3-auth-theme="dark"]) {
    --site-page: #101523;
    --site-band: #15171e;
    --site-card: #151c28;
    --site-field: #0b1018;
    --site-ink: #f2f6fa;
    --site-muted: #b4bfce;
    --site-line: #344152;
    --site-control-line: #63748a;
    --site-header: #121214;
    --site-link: #6acba8;
}

/* Reuse the portal's existing tokens, including the signed-in overrides. */
html[data-mk3-theme],
html[data-mk3-theme] body.mk3-client-style {
    --mk-bg: var(--site-page);
    --mk-surface: var(--site-card);
    --mk-soft: var(--site-band);
    --mk-text: var(--site-ink);
    --mk-muted: var(--site-muted);
    --mk-border: var(--site-line);
    --mk-link: var(--site-link);
}

html[data-mk3-auth-theme] {
    --auth-bg: var(--site-page);
    --auth-panel: var(--site-card);
    --auth-soft: var(--site-band);
    --auth-input: var(--site-field);
    --auth-text: var(--site-ink);
    --auth-muted: var(--site-muted);
    --auth-label: var(--site-ink);
    --auth-border: var(--site-control-line);
    --auth-rule: var(--site-line);
    --auth-link: var(--site-link);
    --auth-button: var(--site-action);
}

html[data-mk3-theme]:has(#mk3-home) {
    --mh-bg: var(--site-page);
    --mh-card: var(--site-card);
    --mh-soft: var(--site-band);
    --mh-line: var(--site-line);
    --mh-ink: var(--site-ink);
    --mh-muted: var(--site-muted);
    --mh-accent: var(--site-link);
    --mh-button: var(--site-action);
    --mh-button-ink: var(--site-on-action);
}

html[data-mk3-theme] body.mk3-portal-skin > :is(.header, .nav-content, #mk3-billing-navigation),
html[data-mk3-theme="dark"] body.mk3-client-style > #mk3-billing-navigation,
html[data-mk3-auth-theme] body > .topbar,
html[data-mk3-auth-theme] body:has(#mk3-register-layout) > .topbar {
    background: var(--site-header) !important;
    border-color: var(--site-line) !important;
}

html[data-mk3-theme] body.mk3-portal-skin > .title,
html[data-mk3-theme="dark"] body.mk3-client-style:has(#mk3-client-content) > .title,
html[data-mk3-auth-theme] .intro,
html[data-mk3-auth-theme] body.mk3-portal-skin #mk3-register-layout .intro {
    background: var(--site-band) !important;
    color: var(--site-ink) !important;
    border-color: var(--site-line) !important;
}

html[data-mk3-auth-theme] .intro :is(.lead,.eyebrow),
html[data-mk3-auth-theme] body.mk3-portal-skin #mk3-register-layout .intro :is(.lead,.eyebrow) {
    color: var(--site-muted) !important;
}

html[data-mk3-auth-theme] .intro h1 span,
html[data-mk3-auth-theme] body.mk3-portal-skin #mk3-register-layout .intro h1 span {
    color: var(--site-link) !important;
}

html[data-mk3-theme] body.mk3-portal-skin > .title h3 {
    color: var(--site-ink) !important;
}

html[data-mk3-theme] body #mk3-billing-navigation :is(.mk3-nav-panel,.dropdown-menu) {
    background: var(--site-card) !important;
    border-color: var(--site-line) !important;
}

html[data-mk3-theme] body #mk3-billing-navigation :is(a,summary,button),
html[data-mk3-theme] body #mk3-billing-navigation .mk3-service-name {
    color: var(--site-ink) !important;
}

html[data-mk3-theme] body #mk3-billing-navigation .mk3-service-description {
    color: var(--site-muted) !important;
}

html[data-mk3-theme="light"] body.mk3-portal-skin > .header .logo img,
html[data-mk3-auth-theme="light"] body > .topbar .logo img {
    filter: invert(1) hue-rotate(180deg) brightness(.74) saturate(.85);
}

html[data-mk3-theme] body #mk3-billing-navigation :is(a[aria-current="page"],.mk3-nav-menu.is-current > summary),
html[data-mk3-theme] body #mk3-billing-navigation .mk3-appearance-menu button[aria-pressed="true"] {
    background: var(--site-band) !important;
    color: var(--site-link) !important;
}

html[data-mk3-theme] body #mk3-billing-navigation :is(.mk3-nav-toggle,.mk3-appearance-menu > summary) {
    background: var(--site-card) !important;
    border-color: var(--site-control-line) !important;
    color: var(--site-ink) !important;
}

html[data-mk3-theme] body #mk3-billing-navigation .mk3-service-icon {
    background: var(--site-band) !important;
    border-color: var(--site-line) !important;
    color: var(--site-link) !important;
}

html[data-mk3-theme] body #mk3-billing-navigation .mk3-appearance-menu > summary > .mk3-service-icon {
    background: transparent !important;
    color: var(--site-link) !important;
}

html[data-mk3-theme] body #mk3-billing-navigation :is(a,summary,button):hover {
    background: var(--site-band) !important;
    color: var(--site-ink) !important;
}

html[data-mk3-theme] body #mk3-billing-navigation :is(a,summary,button):focus-visible {
    outline-color: var(--site-link) !important;
}

html[data-mk3-theme] body.mk3-portal-skin :is(#mk3-ui-scope#mk3-ui-scope,.mk3-order-flow) .mk3-flow-hero,
html[data-mk3-theme] body.mk3-portal-skin:has(:is(#mk3-ui-scope,.mk3-order-flow)) nav#mk3-billing-breadcrumb.mk3-breadcrumb {
    background: var(--site-band) !important;
    color: var(--site-ink) !important;
}

html[data-mk3-theme] body.mk3-portal-skin :is(#mk3-ui-scope#mk3-ui-scope,.mk3-order-flow) .mk3-flow-hero :is(p,span,strong,h1,h2,div) {
    color: var(--site-ink) !important;
    -webkit-text-fill-color: currentColor !important;
}

html[data-mk3-theme] body.mk3-portal-skin:has(:is(#mk3-ui-scope,.mk3-order-flow)) #mk3-billing-breadcrumb.mk3-breadcrumb a {
    color: var(--site-link) !important;
}

html[data-mk3-theme="dark"] body.mk3-client-style #mk3-client-content :is(.card-header,.panel-heading),
html[data-mk3-theme="dark"] body.mk3-client-style #mk3-client-content .table th,
html[data-mk3-theme="dark"] body.mk3-client-style #mk3-client-content .table tbody tr:hover > td {
    background: var(--site-band) !important;
    color: var(--site-ink) !important;
}

html[data-mk3-theme] :is(#mk3-portal-scope,body.mk3-portal-skin) > .container-md .mk3-compact-checkout .mk3-checkout-card {
    color: var(--site-ink) !important;
}

html[data-mk3-theme] :is(#mk3-portal-scope,body.mk3-portal-skin) > .container-md :is(.btn-primary,.btn-success),
html[data-mk3-theme] body.mk3-client-style #mk3-client-content :is(.btn-primary,.btn-success),
html[data-mk3-theme] body.mk3-portal-skin #mk3-home .mh-primary,
html[data-mk3-theme] body .mk3-compact-checkout .mk3-checkout-submit,
html[data-mk3-auth-theme] .account .signin,
html[data-mk3-auth-theme] body.mk3-portal-skin #mk3-register-layout .signup_form button[type="submit"] {
    background: var(--site-action) !important;
    border-color: var(--site-action) !important;
    color: var(--site-on-action) !important;
    -webkit-text-fill-color: currentColor !important;
}

html[data-mk3-theme] :is(#mk3-portal-scope,body.mk3-portal-skin) > .container-md :is(.btn-primary,.btn-success) *,
html[data-mk3-theme] body.mk3-client-style #mk3-client-content :is(.btn-primary,.btn-success) :is(span,i) {
    color: var(--site-on-action) !important;
    -webkit-text-fill-color: currentColor !important;
}

html[data-mk3-theme] :is(#mk3-portal-scope,body.mk3-portal-skin) > .container-md :is(.btn-primary,.btn-success):not(:disabled):hover,
html[data-mk3-theme] body.mk3-portal-skin #mk3-home .mh-primary:hover,
html[data-mk3-theme] body .mk3-compact-checkout .mk3-checkout-submit:not(:disabled):hover,
html[data-mk3-auth-theme] .account .signin:not(:disabled):hover,
html[data-mk3-auth-theme] body.mk3-portal-skin #mk3-register-layout .signup_form button[type="submit"]:not(:disabled):hover {
    background: color-mix(in srgb, var(--site-action) 85%, white) !important;
}

html[data-mk3-theme] :is(#mk3-portal-scope,body.mk3-portal-skin) > .container-md :is(.form-control,select,textarea):focus-visible,
html[data-mk3-theme] body.mk3-client-style #mk3-client-content :is(input,select,textarea,button,a):focus-visible,
html[data-mk3-auth-theme] .native-fields :is(input,select,textarea):focus {
    outline-color: var(--site-link) !important;
    border-color: var(--site-link) !important;
}

.mk3-confirm-page.mk3-confirm-page {
    --mk-bg: var(--site-page);
    --mk-surface: var(--site-card);
    --mk-text: var(--site-ink);
    --mk-muted: var(--site-muted);
    --mk-border: var(--site-line);
    --mk-link: var(--site-link);
}

/* Follow the system when the confirmation theme script is unavailable. */
@media (prefers-color-scheme: dark) {
    html:not([data-mk3-theme]) .mk3-confirm-page {
        --site-page: #101523;
        --site-card: #151c28;
        --site-ink: #f2f6fa;
        --site-muted: #b4bfce;
        --site-line: #344152;
        --site-link: #6acba8;
    }
}

.mk3-confirm-page .mk3-confirm button {
    background: var(--site-action);
    color: var(--site-on-action);
}

.mk3-confirm-page .mk3-confirm :is(a,button):focus-visible {
    outline-color: var(--site-link);
}
