/* SPDX-License-Identifier: LicenseRef-PVIR-Proprietary */

@media screen {
    .button,
    .button.secondary,
    .icon-button,
    input[type="button"],
    input[type="submit"],
    input[type="reset"],
    input::file-selector-button {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: var(--gap-actions);
        min-height: var(--control-height);
        height: auto;
        padding: var(--space-1) var(--control-padding);
        border: var(--border-width) solid var(--line);
        border-radius: var(--control-radius);
        background: var(--surface);
        color: var(--ink);
        font-family: var(--font-family);
        font-size: var(--type-label);
        line-height: var(--leading-label);
        font-weight: var(--weight-label);
        cursor: pointer;
        white-space: normal;
        text-decoration: none;
        transition: background .12s ease, border-color .12s ease;
    }

    .button:not(:disabled):not([aria-disabled="true"]):hover,
    .button.secondary:not(:disabled):not([aria-disabled="true"]):hover,
    .icon-button:not(:disabled):not([aria-disabled="true"]):hover,
    input[type="button"]:not(:disabled):hover,
    input[type="submit"]:not(:disabled):hover,
    input[type="reset"]:not(:disabled):hover,
    input:not(:disabled)::file-selector-button:hover {
        background: var(--surface-2);
        border-color: var(--muted);
    }

    .button.ghost {
        background: transparent;
        border-color: transparent;
    }

    .button.ghost:not(:disabled):not([aria-disabled="true"]):hover {
        background: var(--surface-2);
        border-color: var(--line);
    }

    .button.danger {
        background: var(--surface);
        border-color: var(--bad);
        color: var(--bad);
    }

    .button.danger:not(:disabled):not([aria-disabled="true"]):hover {
        background: var(--bad-bg);
    }

    .button.primary,
    .button.active,
    .button.is-selected,
    .button[aria-selected="true"] {
        background: var(--accent);
        border-color: var(--accent-strong);
        color: var(--ink);
    }

    .button.primary:not(:disabled):not([aria-disabled="true"]):hover,
    .button.active:not(:disabled):not([aria-disabled="true"]):hover,
    .button.is-selected:not(:disabled):not([aria-disabled="true"]):hover,
    .button[aria-selected="true"]:not(:disabled):not([aria-disabled="true"]):hover {
        background: var(--accent-hover);
    }

    .button.icon,
    .icon-button {
        width: var(--control-height);
        min-width: var(--control-height);
        padding: 0;
    }

    .topbar-nav .button.ghost.icon.topbar-action,
    .topbar-tools .button.secondary.icon.topbar-action {
        width: var(--control-height);
        min-width: var(--control-height);
        height: var(--control-height);
        min-height: var(--control-height);
        border-radius: var(--radius-circle);
        padding: 0;
    }

    .topbar #globalCreateButton {
        position: relative;
        height: calc(var(--avatar-size) + var(--border-width) * 2);
        min-height: calc(var(--avatar-size) + var(--border-width) * 2);
        white-space: nowrap;
    }

    @media (max-width: 1100px) {
        .topbar-nav .button.ghost.icon.topbar-action,
        .topbar-tools .button.secondary.icon.topbar-action {
            width: var(--touch-target);
            min-width: var(--touch-target);
            height: var(--touch-target);
            min-height: var(--touch-target);
        }

        .topbar-nav .avatar {
            width: calc(var(--touch-target) - var(--border-width) * 2);
            height: calc(var(--touch-target) - var(--border-width) * 2);
        }

    }

    @media (max-width: 1100px), (pointer: coarse) {
        .topbar #globalCreateButton::after {
            content: "";
            position: absolute;
            left: 0;
            right: 0;
            top: calc((var(--avatar-size) + var(--border-width) * 2 - var(--touch-target)) / 2);
            height: var(--touch-target);
        }
    }

    .button:disabled,
    .icon-button:disabled,
    .button[aria-disabled="true"],
    input[type="button"]:disabled,
    input[type="submit"]:disabled,
    input[type="reset"]:disabled,
    input:disabled::file-selector-button {
        opacity: var(--disabled-opacity);
        cursor: not-allowed;
    }

    .button[aria-busy="true"],
    .icon-button[aria-busy="true"] {
        cursor: progress;
    }

    .button[aria-busy="true"]::before,
    .icon-button[aria-busy="true"]::before {
        content: '';
        width: var(--button-spinner-size);
        height: var(--button-spinner-size);
        flex: 0 0 var(--button-spinner-size);
        border: var(--border-width) solid currentColor;
        border-right-color: transparent;
        border-radius: var(--radius-pill);
        animation: button-working .8s linear infinite;
    }

    @keyframes button-working {
        to {
            transform: rotate(360deg);
        }
    }

    .button:focus-visible,
    .icon-button:focus-visible,
    .table-wrap[tabindex]:focus-visible,
    input:not([type="file"]):focus-visible,
    input[type="file"]:focus-visible::file-selector-button,
    select:focus-visible,
    textarea:focus-visible,
    [data-newsletter-editor]:focus-visible {
        outline: var(--focus-width) solid var(--accent-strong);
        outline-offset: var(--focus-offset);
    }

    input:not([type="hidden"], [type="checkbox"], [type="radio"], [type="button"], [type="submit"], [type="reset"]),
    select,
    textarea,
    [data-newsletter-editor] {
        box-sizing: border-box;
        min-height: var(--control-height);
        min-width: 0;
        max-width: 100%;
        padding: var(--space-2) var(--control-padding);
        border: var(--border-width) solid var(--line);
        border-radius: var(--control-radius);
        font-family: var(--font-family);
        font-size: var(--type-body);
        line-height: var(--leading-body);
        font-weight: var(--weight-normal);
        background: var(--surface);
        color: var(--ink);
    }

    input:not([type="hidden"], [type="checkbox"], [type="radio"], [type="button"], [type="submit"], [type="reset"]),
    select {
        height: var(--control-height);
    }

    textarea,
    [data-newsletter-editor] {
        min-height: calc(var(--control-height) * 3);
        height: auto;
        resize: vertical;
    }

    input[type="date"] {
        display: block;
        max-width: 100%;
        -webkit-appearance: none;
        appearance: none;
    }

    input[type="date"]::-webkit-date-and-time-value {
        min-width: 0;
        text-align: left;
    }

    input[type="file"],
    input[type="file"]:disabled {
        height: auto;
        border: 0;
        padding: 0;
        background: transparent;
    }

    input::file-selector-button {
        margin: 0 var(--gap-actions) 0 0;
    }

    .global-search {
        min-height: var(--control-height);
        height: auto;
        background: var(--surface);
        border: var(--border-width) solid var(--line);
        border-radius: var(--control-radius);
        padding: 0 var(--control-padding);
    }

    .global-search input {
        border: 0;
        border-radius: 0;
        padding: 0;
        height: calc(var(--control-height) - var(--border-width) * 2);
        min-height: calc(var(--control-height) - var(--border-width) * 2);
        background: transparent;
        box-shadow: none;
    }

    select:not([multiple]):is(:not([size]), [size="0"], [size="1"]),
    input[data-result-picker] {
        -webkit-appearance: none;
        appearance: none;
        padding-inline-end: calc(var(--control-padding) + var(--space-3) + var(--gap-actions));
        background-image:
            linear-gradient(45deg,
                transparent calc(50% - var(--border-strong-width) / 2),
                currentColor 0,
                currentColor calc(50% + var(--border-strong-width) / 2),
                transparent 0),
            linear-gradient(-45deg,
                transparent calc(50% - var(--border-strong-width) / 2),
                currentColor 0,
                currentColor calc(50% + var(--border-strong-width) / 2),
                transparent 0);
        background-position:
            right calc(var(--control-padding) + var(--space-3) / 2) center,
            right var(--control-padding) center;
        background-size: calc(var(--space-3) / 2) calc(var(--space-3) / 2);
        background-repeat: no-repeat;
    }

    .global-search:focus-within {
        border-color: var(--accent-strong);
        box-shadow: var(--focus-shadow);
    }

    .global-search input:focus-visible,
    input[type="file"]:focus-visible {
        outline: 0;
    }

    .button b,
    .button strong {
        font: inherit;
    }

    

    .button.line-drag {
        padding: 0;
        cursor: grab;
    }

    .button.line-drag:active {
        cursor: grabbing;
    }

    .sidebar .button.ghost:not(.active, .is-selected, [aria-selected="true"]) {
        color: var(--text-on-dark);
    }

    .sidebar .button.ghost:not(.active, .is-selected, [aria-selected="true"],
        :disabled, [aria-disabled="true"]):hover {
        background: var(--surface-dark-hover);
        color: var(--surface-pure);
    }

    .button:where(.nav-item, .account-button, .result-button, .link-button,
        .type-card, .admin-control-card, .help-start-card, .help-category, .help-article-card) {
        justify-content: flex-start;
        text-align: left;
    }

    .button:is(.type-card, .admin-control-card) {
        flex-direction: column;
        align-items: center;
        justify-content: center;
        min-height: calc(var(--control-height) * 2);
    }

    .button:is(.help-start-card, .help-article-card) {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        min-height: var(--control-height);
        text-align: left;
    }

    .button:where(.result-button, .account-button) {
        justify-content: space-between;
    }

    .button.nav-item {
        font-size: var(--type-body);
        line-height: var(--leading-body);
        font-weight: var(--weight-normal);
    }

    .button.nav-item.active {
        font-weight: var(--weight-heading);
    }

    input:not([type="file"], .global-search input):focus,
    select:focus,
    textarea:focus,
    [data-newsletter-editor]:focus {
        border-color: var(--accent-strong);
        box-shadow: var(--focus-shadow);
    }

    input:disabled,
    select:disabled,
    textarea:disabled,
    [data-newsletter-editor][aria-disabled="true"] {
        color: var(--muted);
        background: var(--surface-2);
        cursor: not-allowed;
    }

    @media (prefers-reduced-motion: reduce) {
        .button,
        .icon-button {
            transition: none;
        }

        .button[aria-busy="true"]::before,
        .icon-button[aria-busy="true"]::before {
            animation: none;
        }
    }

    .icon-button.mobile-only {
        display: none;
    }

    @media (max-width: 1100px) {
        .icon-button.mobile-only {
            display: inline-flex;
        }
    }

    input[type="checkbox"] {
        appearance: none;
        -webkit-appearance: none;
        width: var(--control-height) !important;
        height: var(--control-height) !important;
        min-height: var(--control-height) !important;
        flex: 0 0 auto;
        border: var(--border-width) solid var(--line-strong);
        border-radius: var(--radius-sm);
        background: var(--surface-pure);
        display: inline-grid;
        place-content: center;
        vertical-align: middle;
        margin: 0 var(--space-2) 0 0;
        cursor: pointer;
    }

    .switch-row input[type="checkbox"] {
        place-content: center;
    }

    input[type="checkbox"]::before {
        content: "";
        width: var(--choice-check-width);
        height: var(--choice-check-height);
        border-left: var(--border-strong-width) solid var(--ink);
        border-bottom: var(--border-strong-width) solid var(--ink);
        transform: rotate(-45deg) scale(0);
        transform-origin: center;
        transition: transform .08s ease;
    }

    .switch-row input[type="checkbox"]::before {
        border-left: var(--border-strong-width) solid var(--ink);
        border-bottom: var(--border-strong-width) solid var(--ink);
        transform-origin: center;
    }

    input[type="checkbox"]:checked::before {
        transform: rotate(-45deg) scale(1);
    }

    input[type="checkbox"]:focus-visible {
        outline-offset: var(--focus-offset);
    }

    input[type="radio"] {
        appearance: none;
        -webkit-appearance: none;
        width: var(--choice-size);
        height: var(--choice-size);
        min-height: var(--choice-size);
        min-width: var(--choice-size);
        border: var(--border-width) solid var(--line-strong);
        border-radius: var(--radius-circle);
        background: var(--surface-pure);
        display: inline-grid;
        place-content: center;
        cursor: pointer;
        margin: 0;
    }

    input[type="radio"]::before {
        content: "";
        width: var(--choice-mark-size);
        height: var(--choice-mark-size);
        border-radius: var(--radius-circle);
        background: var(--accent-strong);
        transform: scale(0);
        transition: transform .08s ease;
    }

    input[type="radio"]:checked {
        border-color: var(--accent-strong);
        background: var(--accent-soft-2);
    }

    input[type="radio"]:checked::before {
        transform: scale(1);
    }

    input[type="radio"]:focus-visible {
        outline: 0;
        box-shadow: var(--focus-shadow);
    }

    input[type="checkbox"]:checked {
        border-color: var(--accent-strong);
        background: var(--accent);
    }

    input[type="checkbox"]:focus-visible {
        outline: 0;
        box-shadow: var(--focus-shadow);
    }

    .switch-row input[type="checkbox"] {
        appearance: none;
        -webkit-appearance: none;
        width: var(--switch-width) !important;
        height: var(--switch-height) !important;
        min-height: var(--switch-height) !important;
        border: var(--border-width) solid var(--text-subtle);
        border-radius: var(--radius-pill);
        background: var(--line-strong);
        display: inline-block;
        position: relative;
        margin: 0 var(--space-2) 0 0;
        vertical-align: middle;
        cursor: pointer;
        transition: background .12s ease,border-color .12s ease;
    }

    .switch-row input[type="checkbox"]::before {
        content: "";
        position: absolute;
        width: var(--switch-knob-size);
        height: var(--switch-knob-size);
        border: 0;
        border-radius: var(--radius-circle);
        background: var(--surface-pure);
        box-shadow: var(--switch-shadow);
        left: var(--switch-inset);
        top: var(--switch-inset);
        transform: none;
        transition: left .12s ease;
    }

    .switch-row input[type="checkbox"]:checked {
        background: var(--accent);
        border-color: var(--accent-strong);
    }

    .switch-row input[type="checkbox"]:checked::before {
        left: calc(var(--switch-width) - var(--switch-knob-size) - var(--switch-inset));
        transform: none;
    }

    .switch-row input[type="checkbox"]:focus-visible {
        outline: 0;
        box-shadow: var(--focus-shadow);
    }

    input[type="checkbox"]:disabled,
    input[type="radio"]:disabled {
        opacity: var(--disabled-opacity);
        cursor: not-allowed;
    }
    @media(max-width:760px) {
        .modal-foot>.button {
            min-height: max(var(--control-height),
                calc(var(--type-label) * var(--leading-label) * 2 + var(--space-1) * 2 + var(--border-width) * 2));
        }
        .modal-foot>.button:is(.primary, .danger):last-child {
            grid-column: 2;
        }
        .modal-foot>.button:only-child:last-child {
            grid-column: 1/-1;
            justify-self: end;
        }
    }
}

/* Existing button families get a light finish without changing their state colors or dimensions. */
@media screen {
    :is(#app, #modalLayer, .remote-login-gate)
        :is(.button, .icon-button):not(.primary, .ghost, .danger, .active, .is-selected, [aria-selected="true"]) {
        background-image: var(--glass-control-sheen);
        border-color: var(--glass-control-edge);
        box-shadow: var(--glass-control-shadow);
    }

    :is(#app, #modalLayer, .remote-login-gate)
        :is(.button, .icon-button):not(.primary, .ghost, .danger, .active, .is-selected,
        [aria-selected="true"]):not(:disabled, [aria-disabled="true"]):is(:hover, :focus-visible) {
        box-shadow: var(--glass-control-hover-shadow);
    }

    :is(#app, #modalLayer, .remote-login-gate)
        :is(.button.primary, .button.active, .button.is-selected, .button[aria-selected="true"]) {
        background-image: var(--glass-accent-sheen);
        box-shadow: var(--glass-accent-shadow);
    }

    #app .topbar-nav .avatar {
        background-image: var(--glass-accent-sheen);
        box-shadow: var(--glass-accent-shadow);
    }

    :is(#app, #modalLayer) .button:is(.type-card, .admin-control-card,
        .help-start-card, .help-article-card, .surface-card) {
        background: var(--glass-panel-surface);
        border-radius: var(--radius-lg);
    }

    :is(#app, #modalLayer) .button:is(.type-card, .admin-control-card,
        .help-start-card, .help-article-card, .surface-card):not(.primary, .active,
        .is-selected, .selected, .danger, [aria-selected="true"]) {
        background: var(--glass-panel-surface);
        border-color: var(--glass-edge);
        border-top-color: var(--glass-white-edge);
        border-left-color: var(--glass-white-edge);
        border-right-color: var(--glass-warm-edge);
        box-shadow: var(--glass-panel-shadow);
        -webkit-backdrop-filter: blur(var(--glass-surface-blur));
        backdrop-filter: blur(var(--glass-surface-blur));
    }

    :is(#app, #modalLayer) .button:is(.type-card, .admin-control-card,
        .help-start-card, .help-article-card, .surface-card):not(.primary, .active,
        .is-selected, .selected, .danger, [aria-selected="true"], :disabled,
        [aria-disabled="true"]):is(:hover, :focus-visible) {
        box-shadow: var(--glass-panel-hover-shadow);
    }

    :is(#app, #modalLayer) :is(input:not([type="hidden"], [type="checkbox"], [type="radio"],
        [type="button"], [type="submit"], [type="reset"], [type="file"]), select, textarea):not(:focus-visible),
    :is(#app, #modalLayer) [data-newsletter-editor]:not(:focus-visible) {
        box-shadow: var(--glass-field-shadow);
    }

    :is(#app, #modalLayer) :is(input:not([type="hidden"], [type="checkbox"], [type="radio"],
        [type="button"], [type="submit"], [type="reset"], [type="file"]), select, textarea):not(:disabled),
    :is(#app, #modalLayer) [data-newsletter-editor]:not([aria-disabled="true"]) {
        background-color: var(--surface);
    }

    .remote-login-card .button.ghost {
        color: var(--glass-login-muted);
    }

    :is(#app, #modalLayer) :is(.panel, .kpi, .surface-card, .editor-section, .summary-card, .modal)
        .button:is(.type-card, .admin-control-card, .help-start-card, .help-article-card,
        .surface-card):not(.primary, .danger) {
        background: var(--glass-inner-surface);
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
    }

    .remote-login-card .remote-login-field input {
        color: var(--glass-login-ink);
        background: var(--glass-login-field);
        border-color: var(--glass-login-field-edge);
    }

    .remote-login-card .remote-login-input {
        display: block;
        position: relative;
        margin: 0;
    }

    .remote-login-card .remote-login-icon {
        display: grid;
        place-items: center;
        position: absolute;
        top: 50%;
        left: var(--control-padding);
        width: var(--nav-icon-width);
        height: var(--nav-icon-width);
        margin: 0;
        color: var(--glass-login-muted);
        pointer-events: none;
        transform: translateY(-50%);
    }

    .remote-login-icon svg {
        display: block;
        width: 100%;
        height: 100%;
    }

    .remote-login-card .remote-login-input input {
        padding-inline-start: calc(var(--control-padding) + var(--nav-icon-width) + var(--space-2));
    }

    .remote-login-card .remote-login-field input::placeholder {
        color: var(--glass-login-field-placeholder);
    }

    .remote-login-card .remote-login-field input:focus-visible {
        border-color: var(--accent);
        outline-color: var(--glass-login-field-focus);
    }

    .remote-login-card .button.ghost:not(:disabled):hover {
        color: var(--glass-login-ink);
        background: var(--glass-login-ghost-hover);
        border-color: var(--glass-login-border);
    }
}

@media screen and (prefers-reduced-motion: no-preference) {
    :is(#app, #modalLayer, .remote-login-gate) :is(.button, .icon-button) {
        transition: background .12s ease, border-color .12s ease, box-shadow .18s ease;
    }
}

@media screen {
    @supports ((mask-composite: exclude) or (-webkit-mask-composite: xor)) {
        :is(#app, #modalLayer) .button:is(.type-card, .admin-control-card,
            .help-start-card, .help-article-card, .surface-card) {
            position: relative;
        }

        :is(#app, #modalLayer) .button:is(.type-card, .admin-control-card,
            .help-start-card, .help-article-card, .surface-card)::after {
            content: "";
            position: absolute;
            z-index: 4;
            inset: calc(var(--border-width) * -1);
            padding: var(--border-strong-width);
            border-radius: var(--radius-lg);
            background: var(--glass-rim);
            -webkit-mask: var(--glass-rim-mask) content-box, var(--glass-rim-mask);
            mask: var(--glass-rim-mask) content-box, var(--glass-rim-mask);
            -webkit-mask-composite: xor;
            mask-composite: exclude;
            opacity: .72;
            pointer-events: none;
        }

        :is(#app, #modalLayer) .button:is(.type-card, .admin-control-card,
            .help-start-card, .help-article-card, .surface-card):not(:disabled,
            [aria-disabled="true"]):is(:hover, :focus-visible, .active, .is-selected,
            .selected, [aria-selected="true"])::after {
            opacity: 1;
        }
    }
}

@media screen and (prefers-reduced-motion: no-preference) {
    :is(#app, #modalLayer) .button:is(.type-card, .admin-control-card,
        .help-start-card, .help-article-card, .surface-card)::after {
        transition: opacity .18s ease;
    }
}

