/* Original ornaments inspired by the playful control skins in BELLEROPHON Maritime.
   Decorations occupy control edges; data cells and labels stay unobstructed. */








/* Repeated illustrations stay on chrome and title bands, never grid cells. */
html:is([data-ui-theme="christmas"], [data-ui-theme="halloween"], [data-ui-theme="floral"], [data-ui-theme="space"]) :is(.app-header, .window-title) {
    background-image: var(--theme-texture);
    background-size: var(--theme-texture-size);
}

html[data-ui-theme="christmas"] .app-header {
    border-bottom-color: #cba55d;
}

html[data-ui-theme="halloween"] .app-header {
    border-bottom-color: #f3bb62;
}

/* Small corner ornaments leave button labels, sizing and hit targets intact. */
html:is([data-ui-theme="christmas"], [data-ui-theme="halloween"], [data-ui-theme="floral"], [data-ui-theme="space"]) .button:not(.ghost):not(.danger):not(.warning) {
    position: relative;
    isolation: isolate;
}

html:is([data-ui-theme="christmas"], [data-ui-theme="halloween"], [data-ui-theme="floral"], [data-ui-theme="space"]) .button:not(.ghost):not(.danger):not(.warning)::after {
    content: "";
    position: absolute;
    top: -6px;
    right: -4px;
    width: 18px;
    height: 18px;
    background: var(--theme-ornament) center / contain no-repeat;
    pointer-events: none;
    transition: transform 160ms ease;
}

html:is([data-ui-theme="christmas"], [data-ui-theme="halloween"], [data-ui-theme="floral"], [data-ui-theme="space"]) .button:not(:disabled):hover::after {
    transform: translateY(-1px) rotate(8deg);
}

html:is([data-ui-theme="christmas"], [data-ui-theme="halloween"], [data-ui-theme="floral"], [data-ui-theme="space"]) .button:not(.ghost):not(.danger):not(.warning):not(:disabled):hover {
    box-shadow: inset 0 0 0 1px var(--theme-glint), 0 2px 5px rgb(0 0 0 / 16%);
}

html[data-ui-theme="christmas"] .button:not(.ghost):not(.danger):not(.warning)::before {
    content: "";
    position: absolute;
    inset: -3px -1px auto;
    height: 7px;
    border-radius: var(--button-radius) var(--button-radius) 0 0;
    background: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20120%2010%22%20preserveAspectRatio%3D%22none%22%3E%3Cpath%20d%3D%22M0%200H120V3c-8%200-8%204-15%204s-7-3-15-3-6%205-14%205-7-4-16-4-7%202-15%202-8-4-15-4-8%205-15%205S8%205%200%206Z%22%20fill%3D%22%23f5fbff%22%2F%3E%3Cpath%20d%3D%22M0%206c8-1%208%202%2015%202s8-5%2015-5%207%204%2015%204%206-2%2015-2%208%204%2016%204%206-5%2014-5%208%203%2015%203%207-4%2015-4%22%20fill%3D%22none%22%20stroke%3D%22%23bcd6dd%22%2F%3E%3C%2Fsvg%3E") center top / 100% 7px no-repeat;
    pointer-events: none;
}

html:is([data-ui-theme="christmas"], [data-ui-theme="halloween"], [data-ui-theme="floral"], [data-ui-theme="space"]) .button:disabled::after,
html[data-ui-theme="christmas"] .button:disabled::before {
    opacity: .35;
}

/* Module symbols get a matching badge, leaving the functional icon recognizable. */
html:is([data-ui-theme="christmas"], [data-ui-theme="halloween"], [data-ui-theme="floral"], [data-ui-theme="space"]) .launch-module-symbol {
    position: relative;
    overflow: visible;
}

html:is([data-ui-theme="christmas"], [data-ui-theme="halloween"], [data-ui-theme="floral"], [data-ui-theme="space"]) .launch-module-symbol::after {
    content: "";
    position: absolute;
    width: 22px;
    height: 22px;
    right: -7px;
    bottom: -5px;
    background: var(--theme-ornament) center / contain no-repeat;
    pointer-events: none;
}

html:is([data-ui-theme="christmas"], [data-ui-theme="halloween"], [data-ui-theme="floral"], [data-ui-theme="space"]) .home-navigation .launch-tile {
    border-inline-start-color: var(--theme-glint);
}

html:is([data-ui-theme="christmas"], [data-ui-theme="halloween"], [data-ui-theme="floral"], [data-ui-theme="space"]) .home-navigation .launch-module-trigger {
    position: relative;
    color: #fff9f3;
    background-color: var(--theme-launch-end);
    background-image: linear-gradient(125deg, var(--theme-launch-start), var(--theme-launch-end));
    border-color: color-mix(in srgb, var(--theme-launch-icon) 42%, transparent);
}

html:is([data-ui-theme="christmas"], [data-ui-theme="halloween"], [data-ui-theme="floral"], [data-ui-theme="space"]) .home-navigation .launch-module-trigger:hover,
html:is([data-ui-theme="christmas"], [data-ui-theme="halloween"], [data-ui-theme="floral"], [data-ui-theme="space"]) .home-navigation .launch-module[open] > .launch-module-trigger {
    background-image: linear-gradient(125deg, var(--theme-launch-hover-start), var(--theme-launch-hover-end));
    border-color: var(--theme-glint);
}

html:is([data-ui-theme="christmas"], [data-ui-theme="halloween"], [data-ui-theme="floral"], [data-ui-theme="space"]) .home-navigation .launch-module-symbol {
    color: var(--theme-launch-icon);
    background-color: rgb(255 255 255 / 8%);
}

html:is([data-ui-theme="christmas"], [data-ui-theme="halloween"], [data-ui-theme="floral"], [data-ui-theme="space"]) .home-navigation .launch-module-copy small {
    color: #e4e8df;
}

html:is([data-ui-theme="christmas"], [data-ui-theme="halloween"], [data-ui-theme="floral"], [data-ui-theme="space"]) .home-navigation .launch-module-trigger:focus-visible {
    outline-color: var(--theme-launch-icon);
}

html[data-ui-theme="christmas"] .home-navigation .launch-module-trigger::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 7px;
    border-radius: 10px 10px 0 0;
    background: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20120%2010%22%20preserveAspectRatio%3D%22none%22%3E%3Cpath%20d%3D%22M0%200H120V3c-8%200-8%204-15%204s-7-3-15-3-6%205-14%205-7-4-16-4-7%202-15%202-8-4-15-4-8%205-15%205S8%205%200%206Z%22%20fill%3D%22%23f5fbff%22%2F%3E%3Cpath%20d%3D%22M0%206c8-1%208%202%2015%202s8-5%2015-5%207%204%2015%204%206-2%2015-2%208%204%2016%204%206-5%2014-5%208%203%2015%203%207-4%2015-4%22%20fill%3D%22none%22%20stroke%3D%22%23bcd6dd%22%2F%3E%3C%2Fsvg%3E") center top / 100% 7px no-repeat;
    pointer-events: none;
}

html:is([data-ui-theme="christmas"], [data-ui-theme="halloween"], [data-ui-theme="floral"], [data-ui-theme="space"]) :is(.fieldset-panel > legend, .window-title .kicker)::after {
    content: "";
    display: inline-block;
    width: 18px;
    height: 18px;
    margin-inline-start: 7px;
    vertical-align: middle;
    background: var(--theme-ornament) center / contain no-repeat;
    pointer-events: none;
}

/* Keep native checkbox semantics and keyboard behavior. An explicit white tick
   is present only when selected; the ornament is not used as the state cue. */
html:is([data-ui-theme="christmas"], [data-ui-theme="halloween"], [data-ui-theme="floral"], [data-ui-theme="space"]) input[type="checkbox"]:not([role="switch"]) {
    appearance: none;
    -webkit-appearance: none;
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    min-height: 14px;
    padding: 0;
    border: 0;
    border-radius: 2px;
    background-color: transparent;
    background-image: var(--theme-checkbox);
    background-position: center;
    background-size: contain;
    background-repeat: no-repeat;
    vertical-align: middle;
    cursor: pointer;
    box-shadow: none;
}

html:is([data-ui-theme="christmas"], [data-ui-theme="halloween"], [data-ui-theme="floral"], [data-ui-theme="space"]) input[type="checkbox"]:not([role="switch"]):checked {
    background-image: var(--theme-checkbox-checked);
}

html:is([data-ui-theme="christmas"], [data-ui-theme="halloween"], [data-ui-theme="floral"], [data-ui-theme="space"]) input[type="checkbox"]:not([role="switch"]):indeterminate {
    border: 1px solid var(--line-strong);
    background-color: var(--accent);
    background-image: linear-gradient(#ffffff, #ffffff);
    background-size: 9px 2px;
}

html:is([data-ui-theme="christmas"], [data-ui-theme="halloween"], [data-ui-theme="floral"], [data-ui-theme="space"]) input[type="checkbox"]:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

html:is([data-ui-theme="christmas"], [data-ui-theme="halloween"], [data-ui-theme="floral"], [data-ui-theme="space"]) input[type="checkbox"]:disabled {
    background-color: transparent;
    opacity: .5;
    cursor: not-allowed;
}

/* The new palettes also apply to secondary actions and disabled controls. */
html:is([data-ui-theme="christmas"], [data-ui-theme="halloween"], [data-ui-theme="floral"], [data-ui-theme="space"]) .button.ghost {
    color: var(--ink);
    background-color: var(--field);
    border-color: var(--line-strong);
}

html:is([data-ui-theme="christmas"], [data-ui-theme="halloween"], [data-ui-theme="floral"], [data-ui-theme="space"]) .button.ghost:hover {
    background-color: var(--accent-soft);
}

html:is([data-ui-theme="christmas"], [data-ui-theme="halloween"], [data-ui-theme="floral"], [data-ui-theme="space"]) :is(button, .button, input:not([type="checkbox"]), select, textarea):disabled {
    color: var(--disabled-ink);
    background-color: var(--panel-2);
    border-color: var(--line);
}

html[data-ui-theme="halloween"] :is(.window-title .kicker, .orders-title-order) {
    color: #f3c489;
}

/* Keep grid headings and selection readable within each palette. Status colors
   supplied by the data remain on their cells; no artwork is added to tables. */
html:is([data-ui-theme="christmas"], [data-ui-theme="halloween"], [data-ui-theme="floral"], [data-ui-theme="space"]) :is(.orders-grid, .stock-grid, .worklist-grid, .vcm-grid, .compact-grid, .operations-grid) th {
    color: var(--chrome-ink);
    background-color: var(--chrome-2);
    border-color: var(--line-strong);
}

html:is([data-ui-theme="christmas"], [data-ui-theme="halloween"], [data-ui-theme="floral"], [data-ui-theme="space"]) :is(.orders-grid, .stock-grid, .worklist-grid, .vcm-grid, .compact-grid, .operations-grid) th.sorted {
    background-color: color-mix(in srgb, var(--chrome-2) 80%, var(--accent));
}

html:is([data-ui-theme="christmas"], [data-ui-theme="halloween"], [data-ui-theme="floral"], [data-ui-theme="space"]) :is(.orders-grid, .stock-grid, .worklist-grid, .vcm-grid, .compact-grid, .operations-grid) tbody tr:nth-child(even) {
    background-color: var(--panel);
}

html:is([data-ui-theme="christmas"], [data-ui-theme="halloween"], [data-ui-theme="floral"], [data-ui-theme="space"]) :is(.orders-grid, .stock-grid, .worklist-grid, .vcm-grid, .compact-grid, .operations-grid) tbody tr:hover {
    color: var(--ink);
    background-color: color-mix(in srgb, var(--accent-soft) 65%, var(--panel));
}

html:is([data-ui-theme="christmas"], [data-ui-theme="halloween"], [data-ui-theme="floral"], [data-ui-theme="space"]) .stock-grid tbody tr:hover td {
    color: var(--ink);
    background-color: color-mix(in srgb, var(--accent-soft) 65%, var(--panel));
}

html:is([data-ui-theme="christmas"], [data-ui-theme="halloween"], [data-ui-theme="floral"], [data-ui-theme="space"]) :is(.orders-grid, .stock-grid, .worklist-grid, .vcm-grid, .compact-grid, .operations-grid) tbody tr:is(.selected, .row-selected) td {
    color: var(--ink);
    background-color: var(--accent-soft);
    outline-color: var(--line-strong);
    box-shadow: inset 0 0 0 1px var(--line-strong);
}

@media (prefers-reduced-motion: reduce) {
    html:is([data-ui-theme="christmas"], [data-ui-theme="halloween"], [data-ui-theme="floral"], [data-ui-theme="space"]) .button:not(:disabled):hover::after {
        transition: none;
        transform: none;
    }
}

@media (forced-colors: active) {
    html:is([data-ui-theme="christmas"], [data-ui-theme="halloween"], [data-ui-theme="floral"], [data-ui-theme="space"]) :is(.app-header, .window-title, .home-navigation .launch-module-trigger) {
        color: CanvasText;
        background: Canvas !important;
        border-color: ButtonText;
    }

    html:is([data-ui-theme="christmas"], [data-ui-theme="halloween"], [data-ui-theme="floral"], [data-ui-theme="space"]) .home-navigation :is(.launch-module-symbol, .launch-module-copy small) {
        color: CanvasText;
    }

    html[data-ui-theme="christmas"] .home-navigation .launch-module-trigger::before {
        display: none;
    }

    html:is([data-ui-theme="christmas"], [data-ui-theme="halloween"], [data-ui-theme="floral"], [data-ui-theme="space"]) input[type="checkbox"]:not([role="switch"]) {
        appearance: auto;
        -webkit-appearance: auto;
        background: none !important;
        opacity: 1;
    }

    html:is([data-ui-theme="christmas"], [data-ui-theme="halloween"], [data-ui-theme="floral"], [data-ui-theme="space"]) :is(.button, .launch-module-symbol, .fieldset-panel > legend, .window-title .kicker)::after,
    html[data-ui-theme="christmas"] .button::before {
        display: none;
    }
}

/* Native radios and switches share the selected palette. */
html:is([data-ui-theme="christmas"], [data-ui-theme="halloween"], [data-ui-theme="floral"], [data-ui-theme="space"]) input:is([type="radio"], [role="switch"]) { accent-color: var(--accent); }
