/*
 * DEEPTASK tokenized glass controls (aligned 1:1 with EMODIBOK ecosystem).
 * - Unified 42px control height for inputs, selects, buttons, tabs, chips & toggle rows.
 * - Strict interaction state contract: Default -> Hover (unactivated only) -> Active/Focus (orange rim + glow).
 * - Once activated (.is-active, .active, [aria-pressed="true"], :focus, :checked toggle ON), hover has ZERO effect.
 * - Pure typography controls; zero icons inside buttons or next to text.
 */

/* ── 1. Inputs, Selects & Textareas (Unified 42px, Border-Only, ZERO Glow) ─ */
.deeptask-scope .dt-input,
.deeptask-scope .dt-select,
.deeptask-scope .dt-textarea,
body.deeptask-admin-screen .deeptask-scope :is(.dt-input, .dt-select, .dt-textarea) {
    width: 100%;
    height: var(--deeptask-control-height);
    min-height: var(--deeptask-control-height);
    max-width: 100%;
    margin: 0;
    padding: 0 14px;
    border: 1px solid var(--deeptask-color-glass-border);
    border-radius: var(--deeptask-radius);
    background: var(--deeptask-color-input-bg);
    background-clip: padding-box;
    color: var(--deeptask-color-glass-text);
    box-shadow: none !important;
    box-sizing: border-box;
    font-family: var(--deeptask-font-regular);
    font-size: var(--deeptask-font-size);
    font-weight: 400;
    letter-spacing: 0.01em;
    line-height: 1.25;
    outline: none !important;
    transition: var(--deeptask-control-transition);
}

.deeptask-scope .dt-select,
body.wp-core-ui .deeptask-scope select.dt-select,
body.deeptask-admin-screen .deeptask-scope .dt-select {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    max-width: 100% !important;
    padding: 0 34px 0 14px;
    background-color: var(--deeptask-color-glass-background);
    background-image:
        linear-gradient(45deg, var(--deeptask-color-transparent) 50%, var(--deeptask-color-glass-text) 50%, var(--deeptask-color-glass-text) calc(50% + 2px), var(--deeptask-color-transparent) calc(50% + 2px)),
        linear-gradient(135deg, var(--deeptask-color-transparent) calc(50% - 2px), var(--deeptask-color-glass-text) calc(50% - 2px), var(--deeptask-color-glass-text) 50%, var(--deeptask-color-transparent) 50%);
    background-position:
        calc(100% - 20px) calc(50% + 1px),
        calc(100% - 14px) calc(50% + 1px);
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
}

.deeptask-scope .dt-select option {
    background: var(--deeptask-color-panel);
    color: var(--deeptask-color-text);
}

.deeptask-scope .dt-textarea,
body.deeptask-admin-screen .deeptask-scope .dt-textarea {
    height: auto;
    min-height: 96px;
    padding: 10px 14px;
    line-height: 1.5;
    resize: vertical;
}

/* Hover ONLY when NOT disabled, NOT readonly, NOT filled, NOT focused, NOT active, NOT expanded (zero glow) */
@media (hover: hover) {

    .deeptask-scope :is(.dt-input, .dt-select, .dt-textarea):not(.dt-input-control):not(:disabled):not([readonly]):not(:focus):not(:focus-visible):not(:active):not(.is-open):not([aria-expanded="true"]):not([value]:not([value=""])):not([placeholder]:not(:placeholder-shown)):hover,
    body.deeptask-admin-screen .deeptask-scope :is(.dt-input, .dt-select, .dt-textarea):not(.dt-input-control):not(:disabled):not([readonly]):not(:focus):not(:focus-visible):not(:active):not(.is-open):not([aria-expanded="true"]):not([value]:not([value=""])):not([placeholder]:not(:placeholder-shown)):hover {
        border-color: var(--deeptask-color-hover-border);
        background-color: var(--deeptask-color-hover-bg);
        color: var(--deeptask-color-glass-text);
        box-shadow: none !important;
    }
}

/* Active / Focus / Filled / Autofill state: crisp 1px primary border ONLY, clean surface, ZERO glow, locks against hover */
.deeptask-scope :is(.dt-input, .dt-select, .dt-textarea):not(.dt-input-control):not(:disabled):not([readonly]):is(:focus, :focus-visible, :active, .is-open, [aria-expanded="true"]),
.deeptask-scope :is(.dt-input, .dt-select, .dt-textarea):not(.dt-input-control):not(:disabled):not([readonly]):is(:focus, :focus-visible, :active, .is-open, [aria-expanded="true"]):hover,
body.deeptask-admin-screen .deeptask-scope :is(.dt-input, .dt-select, .dt-textarea):not(.dt-input-control):not(:disabled):not([readonly]):is(:focus, :focus-visible, :active, .is-open, [aria-expanded="true"]),
body.deeptask-admin-screen .deeptask-scope :is(.dt-input, .dt-select, .dt-textarea):not(.dt-input-control):not(:disabled):not([readonly]):is(:focus, :focus-visible, :active, .is-open, [aria-expanded="true"]):hover,
.deeptask-scope input.dt-input:not(.dt-input-control):not(:disabled):not([type="file"]):not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):is([value]:not([value=""]), [placeholder]:not(:placeholder-shown), :autofill, :-webkit-autofill),
.deeptask-scope input.dt-input:not(.dt-input-control):not(:disabled):not([type="file"]):not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):is([value]:not([value=""]), [placeholder]:not(:placeholder-shown), :autofill, :-webkit-autofill):hover,
.deeptask-scope textarea:is(.dt-textarea, .dt-input):not(.dt-input-control):not(:disabled):is(:not(:empty), [placeholder]:not(:placeholder-shown), :autofill, :-webkit-autofill),
.deeptask-scope textarea:is(.dt-textarea, .dt-input):not(.dt-input-control):not(:disabled):is(:not(:empty), [placeholder]:not(:placeholder-shown), :autofill, :-webkit-autofill):hover {
    border-color: var(--deeptask-color-glass-border-active);
    background-color: var(--deeptask-color-input-bg);
    color: var(--deeptask-color-glass-text);
    box-shadow: none !important;
    outline: none !important;
}

.deeptask-scope :is(.dt-input, .dt-select, .dt-textarea):not(.dt-input-control):disabled,
body.deeptask-admin-screen .deeptask-scope :is(.dt-input, .dt-select, .dt-textarea):not(.dt-input-control):disabled {
    border-color: var(--deeptask-color-glass-border);
    background-color: var(--deeptask-color-disabled-bg);
    color: var(--deeptask-color-text-disabled);
    box-shadow: none !important;
    cursor: not-allowed;
    opacity: 0.7;
}

/* ── 1b. DeepFile-style Notched Floating-Label Input Shell (Input & Textarea) ─ */
/* Zero-CLS pre-hydration: position floating input AND textarea labels out of flow from Frame 0 before JS runs. */
.deeptask-scope .dt-field:has(> input.dt-input:not([data-dt-static-label]):not([type="file"]):not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), > textarea.dt-textarea:not([data-dt-static-label]), > textarea.dt-input:not([data-dt-static-label])) {
    position: relative;
}

.deeptask-scope .dt-field:has(> input.dt-input:not([data-dt-static-label]):not([type="file"]):not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), > textarea.dt-textarea:not([data-dt-static-label]), > textarea.dt-input:not([data-dt-static-label]))>.dt-field__label:not(.dt-label-source) {
    position: absolute;
    top: 0;
    left: 14px;
    z-index: 2;
    max-width: calc(100% - 28px);
    transform: translateY(-50%);
    font-family: var(--deeptask-font-regular);
    font-size: var(--deeptask-floating-label-size);
    font-weight: 400;
    line-height: 12px;
    letter-spacing: 0.02em;
    color: var(--deeptask-color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
}

.deeptask-scope .dt-label-source {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    clip-path: inset(50%) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.deeptask-scope .dt-input-shell {
    position: relative;
    display: block;
    width: 100%;
    min-width: 0;
    min-height: var(--deeptask-control-height);
    margin: 0;
    padding: 0;
    border-radius: var(--deeptask-radius);
    background: var(--deeptask-color-transparent);
    color: var(--deeptask-color-text);
    box-shadow: none !important;
    text-align: left;
    box-sizing: border-box;
}

.deeptask-scope .dt-input-shell::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: var(--deeptask-color-input-bg);
    pointer-events: none;
    transition: background 180ms ease;
}

.deeptask-scope .dt-input-shell .dt-input-control,
body.deeptask-admin-screen .deeptask-scope .dt-input-shell .dt-input-control {
    position: relative;
    z-index: 1;
    display: block;
    width: 100%;
    max-width: none;
    min-width: 0;
    height: var(--deeptask-control-height);
    min-height: var(--deeptask-control-height);
    margin: 0;
    padding: 0 14px;
    border: 0 !important;
    border-radius: inherit;
    outline: none !important;
    background: var(--deeptask-color-transparent) !important;
    color: var(--deeptask-color-text);
    box-shadow: none !important;
    font-family: var(--deeptask-font-regular);
    font-size: var(--deeptask-font-size);
    font-weight: 400;
    letter-spacing: 0.01em;
    line-height: 20px;
    box-sizing: border-box;
}

.deeptask-scope .dt-input-shell select.dt-input-control,
body.deeptask-admin-screen .deeptask-scope .dt-input-shell select.dt-input-control {
    padding-right: 30px;
}

.deeptask-scope .dt-input-shell .dt-input-control::placeholder {
    color: var(--deeptask-color-transparent) !important;
    opacity: 0;
}

.deeptask-scope .dt-input-shell.dt-input-raised .dt-input-control::placeholder,
.deeptask-scope .dt-input-shell > .dt-input-control:is(:autofill, :-webkit-autofill, [data-dt-placeholder-state]:not(:placeholder-shown))::placeholder {
    color: var(--deeptask-color-text-soft) !important;
    opacity: 1;
}

.deeptask-scope .dt-input-shell .dt-input-outline {
    position: absolute;
    inset: -6px 0 0;
    min-width: 0;
    margin: 0;
    padding: 0 8px;
    border: 1px solid var(--deeptask-color-glass-border);
    border-radius: inherit;
    box-shadow: none !important;
    pointer-events: none;
    transition: border-color 180ms ease;
}

.deeptask-scope .dt-input-shell .dt-input-outline legend {
    display: block;
    float: none;
    width: auto;
    max-width: 0.01px;
    height: 12px;
    margin: 0;
    padding: 0;
    font-family: var(--deeptask-font-regular);
    font-size: var(--deeptask-floating-label-size);
    font-weight: 400;
    line-height: 12px;
    letter-spacing: 0.02em;
    white-space: nowrap;
    overflow: hidden;
    visibility: hidden;
    transition: max-width 160ms ease, padding 160ms ease;
}

.deeptask-scope .dt-input-shell .dt-input-outline legend span {
    font-family: inherit;
    font-size: inherit;
    font-weight: inherit;
    line-height: inherit;
    letter-spacing: inherit;
}

.deeptask-scope .dt-input-shell.dt-input-raised .dt-input-outline legend,
.deeptask-scope .dt-input-shell:focus-within:not(:where(.dt-input-value-only)) .dt-input-outline legend,
.deeptask-scope .dt-input-shell > .dt-input-control:where(:autofill, :-webkit-autofill, [data-dt-placeholder-state]:not(:placeholder-shown)) ~ .dt-input-outline legend {
    max-width: 100%;
    padding: 0 5px;
}

.deeptask-scope .dt-input-shell .dt-input-label {
    position: absolute;
    z-index: 2;
    top: 21px;
    left: 14px;
    max-width: calc(100% - 28px);
    overflow: hidden;
    padding-block: 2px;
    transform: translateY(-50%);
    color: var(--deeptask-color-text-muted);
    background: var(--deeptask-color-transparent);
    font-family: var(--deeptask-font-regular);
    font-size: var(--deeptask-font-size);
    font-weight: 400;
    line-height: 20px;
    white-space: nowrap;
    text-overflow: ellipsis;
    pointer-events: none;
    transition: top 160ms ease, font-size 160ms ease, line-height 160ms ease, color 160ms ease;
}

.deeptask-scope .dt-input-shell.dt-input-raised .dt-input-label,
.deeptask-scope .dt-input-shell:focus-within:not(:where(.dt-input-value-only)) .dt-input-label,
.deeptask-scope .dt-input-shell > .dt-input-control:where(:autofill, :-webkit-autofill, [data-dt-placeholder-state]:not(:placeholder-shown)) ~ .dt-input-label {
    top: 0;
    font-size: var(--deeptask-floating-label-size);
    line-height: 12px;
    letter-spacing: 0.02em;
    color: var(--deeptask-color-text);
}

/* ── 1c. Modern Dropdown (EMODIBOK Panel + DeepFile 'v' Chevron, No Label / No Placeholder) ─ */
.deeptask-scope .dt-field:has(> .dt-select-shell, > select.dt-select)>.dt-field__label {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    clip-path: inset(50%) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.deeptask-scope .dt-select-shell {
    position: relative;
    display: block;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.deeptask-scope .dt-select-source {
    position: absolute !important;
    width: 1px !important;
    min-width: 0 !important;
    height: 1px !important;
    min-height: 0 !important;
    margin: -1px !important;
    padding: 0 !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    clip-path: inset(50%) !important;
    opacity: 0 !important;
    pointer-events: none !important;
    border: 0 !important;
    background: none !important;
}

.deeptask-scope .dt-select-trigger {
    appearance: none;
    -webkit-appearance: none;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    min-width: 0;
    height: var(--deeptask-control-height);
    min-height: var(--deeptask-control-height);
    margin: 0;
    padding: 0 14px;
    border: 1px solid var(--deeptask-color-glass-border);
    border-radius: var(--deeptask-radius);
    background: var(--deeptask-color-glass-background);
    background-clip: padding-box;
    color: var(--deeptask-color-glass-text);
    box-shadow: none;
    box-sizing: border-box;
    font-family: var(--deeptask-font-regular);
    font-size: var(--deeptask-font-size);
    font-weight: 400;
    letter-spacing: 0.01em;
    line-height: 1.25;
    text-align: left;
    cursor: pointer;
    outline: none;
    transition: var(--deeptask-control-transition);
}

.deeptask-scope .dt-select-value {
    flex: 1 1 auto;
    min-width: 0;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.deeptask-scope .dt-select-value__text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.deeptask-scope .dt-gcal-dot,
.dt-dropdown-panel .dt-gcal-dot {
    width: 10px;
    height: 10px;
    flex: 0 0 10px;
    border-radius: var(--deeptask-radius-pill);
    background: var(--deeptask-color-border-strong);
}

.dt-gcal-dot--1  { background: var(--deeptask-gcal-color-1) !important; }
.dt-gcal-dot--2  { background: var(--deeptask-gcal-color-2) !important; }
.dt-gcal-dot--3  { background: var(--deeptask-gcal-color-3) !important; }
.dt-gcal-dot--4  { background: var(--deeptask-gcal-color-4) !important; }
.dt-gcal-dot--5  { background: var(--deeptask-gcal-color-5) !important; }
.dt-gcal-dot--6  { background: var(--deeptask-gcal-color-6) !important; }
.dt-gcal-dot--7  { background: var(--deeptask-gcal-color-7) !important; }
.dt-gcal-dot--8  { background: var(--deeptask-gcal-color-8) !important; }
.dt-gcal-dot--9  { background: var(--deeptask-gcal-color-9) !important; }
.dt-gcal-dot--10 { background: var(--deeptask-gcal-color-10) !important; }
.dt-gcal-dot--11 { background: var(--deeptask-gcal-color-11) !important; }

/* DeepFile crisp pure-CSS 'v' chevron (zero SVG) */
.deeptask-scope .dt-select-chevron {
    width: 8px;
    height: 8px;
    flex: 0 0 8px;
    margin: 0 2px 4px 6px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    transition: transform 200ms ease;
    box-sizing: border-box;
}

.deeptask-scope .dt-select-trigger[aria-expanded="true"] .dt-select-chevron {
    transform: translateY(4px) rotate(225deg);
}

/* Hover ONLY when closed, unfocused, and enabled */
@media (hover: hover) {
    .deeptask-scope .dt-select-trigger:not(:disabled):not([aria-expanded="true"]):not(:focus-visible):not(:active):hover {
        border-color: var(--deeptask-color-hover-border);
        background: var(--deeptask-color-hover-bg);
        color: var(--deeptask-color-hover-text);
        box-shadow: none;
    }
}

/* Open / Active / Focus: EMODIBOK primary rim + subtle active surface, hover locked out */
.deeptask-scope .dt-select-trigger:not(:disabled):is([aria-expanded="true"], :focus-visible, :active),
.deeptask-scope .dt-select-trigger:not(:disabled)[aria-expanded="true"]:hover {
    border-color: var(--deeptask-color-glass-border-active);
    background: var(--deeptask-color-glass-background-active);
    color: var(--deeptask-color-glass-text);
    box-shadow: var(--deeptask-glass-shadow-active);
    outline: none;
}

.deeptask-scope .dt-select-trigger:disabled {
    border-color: var(--deeptask-color-glass-border);
    background: var(--deeptask-color-disabled-bg);
    color: var(--deeptask-color-text-disabled);
    box-shadow: none;
    cursor: not-allowed;
    opacity: 0.7;
}

.deeptask-scope .dt-select-shell.dt-select-invalid .dt-select-trigger {
    border-color: var(--deeptask-color-danger);
}

/* Anchored dropdown shared by pages and dialogs. */
.dt-dropdown-panel {
    position: fixed;
    inset: auto;
    z-index: 2147483000;
    isolation: isolate;
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0;
    padding: 12px;
    max-height: 292px;
    border: 1px solid var(--deeptask-color-glass-border);
    border-radius: var(--deeptask-dropdown-radius);
    background: var(--deeptask-color-dropdown-bg);
    background-clip: padding-box;
    color: var(--deeptask-color-text);
    box-shadow: var(--deeptask-shadow-md);
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
    font-family: var(--deeptask-font-sans);
}

.dt-dropdown-panel::backdrop {
    display: none;
}

.dt-dropdown-panel::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

.dt-dropdown-panel .dt-dropdown-group {
    padding: 4px 10px 2px;
    font-size: var(--deeptask-font-size);
    font-family: var(--deeptask-font-emphasis);
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--deeptask-color-text-soft);
}

.dt-dropdown-panel .dt-dropdown-option {
    appearance: none;
    -webkit-appearance: none;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    width: 100%;
    flex: 0 0 auto;
    min-height: var(--deeptask-control-height);
    padding: 8px 14px;
    border: 1px solid var(--deeptask-color-glass-border);
    border-radius: var(--deeptask-radius);
    background: var(--deeptask-color-glass-background);
    color: var(--deeptask-color-glass-text);
    box-shadow: none;
    box-sizing: border-box;
    font-family: var(--deeptask-font-regular);
    font-size: var(--deeptask-font-size);
    font-weight: 400;
    line-height: 1.35;
    text-align: left;
    cursor: pointer;
    outline: none;
    transition: var(--deeptask-control-transition);
}

@media (hover: hover) {
    .dt-dropdown-panel .dt-dropdown-option:not(:disabled):not(.is-selected):not([aria-selected="true"]):hover {
        border-color: var(--deeptask-color-hover-border);
        background: var(--deeptask-color-hover-bg);
        color: var(--deeptask-color-hover-text);
        box-shadow: none;
    }
}

.dt-dropdown-panel .dt-dropdown-option:not(:disabled):is(.is-selected, [aria-selected="true"], .is-highlighted, :focus-visible, :active),
.dt-dropdown-panel .dt-dropdown-option:not(:disabled):is(.is-selected, [aria-selected="true"]):hover {
    border-color: var(--deeptask-color-glass-border-active);
    background: var(--deeptask-color-glass-background-active);
    color: var(--deeptask-color-text);
    box-shadow: var(--deeptask-glass-shadow-active);
    font-family: var(--deeptask-font-emphasis);
    font-weight: 400;
}

.dt-dropdown-panel .dt-dropdown-option:disabled {
    border-color: var(--deeptask-color-glass-border);
    background: var(--deeptask-color-disabled-bg);
    color: var(--deeptask-color-text-disabled);
    cursor: not-allowed;
    opacity: 0.7;
}

/* Hover ONLY when empty, unfocused, enabled, and non-readonly (crisp 1px rim, ZERO glow) */
@media (hover: hover) {
    .deeptask-scope .dt-input-shell:not(.dt-input-disabled):not(.dt-input-readonly):not(.dt-input-filled):not(:focus-within):not(:has(> .dt-input-control:is(:autofill, :-webkit-autofill))):hover .dt-input-outline {
        border-color: var(--deeptask-color-hover-border);
    }

    .deeptask-scope .dt-input-shell:not(.dt-input-disabled):not(.dt-input-readonly):not(.dt-input-filled):not(:focus-within):not(:has(> .dt-input-control:is(:autofill, :-webkit-autofill))):hover::before {
        background: var(--deeptask-color-hover-bg);
    }
}

/* Focus / Filled / Autofill Active state: crisp 1px primary border, clean surface, ZERO glow, hover locked out */
.deeptask-scope .dt-input-shell:not(.dt-input-disabled):not(.dt-input-readonly):focus-within:not(.dt-input-invalid) .dt-input-outline,
.deeptask-scope .dt-input-shell:not(.dt-input-disabled):not(.dt-input-readonly):focus-within:not(.dt-input-invalid):hover .dt-input-outline,
.deeptask-scope .dt-input-shell:not(.dt-input-disabled).dt-input-filled:not(.dt-input-invalid) .dt-input-outline,
.deeptask-scope .dt-input-shell:not(.dt-input-disabled).dt-input-filled:not(.dt-input-invalid):hover .dt-input-outline,
.deeptask-scope .dt-input-shell:not(.dt-input-disabled):has(> .dt-input-control:is(:autofill, :-webkit-autofill)):not(.dt-input-invalid) .dt-input-outline,
.deeptask-scope .dt-input-shell:not(.dt-input-disabled):has(> .dt-input-control:is(:autofill, :-webkit-autofill)):not(.dt-input-invalid):hover .dt-input-outline {
    border-color: var(--deeptask-color-primary);
    box-shadow: none !important;
}

.deeptask-scope .dt-input-shell:not(.dt-input-disabled):not(.dt-input-readonly):focus-within::before,
.deeptask-scope .dt-input-shell:not(.dt-input-disabled):not(.dt-input-readonly):focus-within:hover::before,
.deeptask-scope .dt-input-shell:not(.dt-input-disabled).dt-input-filled::before,
.deeptask-scope .dt-input-shell:not(.dt-input-disabled).dt-input-filled:hover::before {
    background: var(--deeptask-color-input-bg);
}

.deeptask-scope .dt-input-shell:not(.dt-input-disabled):not(.dt-input-readonly):focus-within .dt-input-label,
.deeptask-scope .dt-input-shell:not(.dt-input-disabled).dt-input-filled .dt-input-label,
.deeptask-scope .dt-input-shell:not(.dt-input-disabled):has(> .dt-input-control:is(:autofill, :-webkit-autofill)) .dt-input-label {
    color: var(--deeptask-color-text);
}

.deeptask-scope .dt-input-shell.dt-input-invalid .dt-input-outline {
    border-color: var(--deeptask-color-danger);
}

.deeptask-scope .dt-input-shell.dt-input-invalid .dt-input-label {
    color: var(--deeptask-color-danger);
}

.deeptask-scope .dt-input-shell.dt-input-disabled::before {
    background: var(--deeptask-color-disabled-bg);
}

.deeptask-scope .dt-input-shell.dt-input-disabled :is(.dt-input-label, .dt-input-control) {
    color: var(--deeptask-color-text-disabled);
    cursor: not-allowed;
}

/* ── 2. Buttons (Unified 42px Glass Contract, Zero Hover on Active) ───── */
.deeptask-scope .dt-btn {
    appearance: none;
    -webkit-appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: var(--deeptask-control-height);
    min-height: var(--deeptask-control-height);
    padding: 0 18px;
    border: 1px solid var(--deeptask-color-glass-border);
    border-radius: var(--deeptask-radius);
    background: var(--deeptask-color-glass-background);
    color: var(--deeptask-color-glass-text);
    box-shadow: var(--deeptask-glass-shadow);
    box-sizing: border-box;
    font-family: var(--deeptask-font-regular);
    font-size: var(--deeptask-font-size);
    font-weight: 400;
    letter-spacing: 0.01em;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    outline: none;
    transform: none;
    transition: var(--deeptask-control-transition);
}

.deeptask-scope .dt-btn--sm {
    height: var(--deeptask-control-height);
    min-height: var(--deeptask-control-height);
    padding: 0 14px;
    font-size: var(--deeptask-font-size);
}

/* Hover ONLY on unactivated, unfocused, enabled buttons */
@media (hover: hover) {
    .deeptask-scope .dt-btn:not(:disabled):not([aria-disabled="true"]):not(.is-active):not(.active):not(.is-selected):not([aria-pressed="true"]):not(:focus-visible):not(:active):not(.dt-btn--primary):not(.dt-btn--danger):not(.dt-btn--success):hover {
        border-color: var(--deeptask-color-hover-border);
        background: var(--deeptask-color-hover-bg);
        color: var(--deeptask-color-hover-text);
        box-shadow: var(--deeptask-glass-shadow-hover);
        transform: none;
    }
}

/* Press / Keyboard focus state */
.deeptask-scope .dt-btn:not(:disabled):not([aria-disabled="true"]):not(.dt-btn--primary):not(.dt-btn--danger):not(.dt-btn--success):is(:focus-visible, :active) {
    border-color: var(--deeptask-color-glass-border-active);
    background: var(--deeptask-color-glass-background-active);
    color: var(--deeptask-color-glass-text);
    box-shadow: var(--deeptask-glass-shadow-active);
}

/* Persistent Active state (e.g. .dt-btn--switch.is-active, [aria-pressed="true"]): hover has ZERO effect */
.deeptask-scope .dt-btn:is(.is-active, .active, .is-selected, [aria-pressed="true"]),
.deeptask-scope .dt-btn:is(.is-active, .active, .is-selected, [aria-pressed="true"]):hover,
.deeptask-scope .dt-btn:is(.is-active, .active, .is-selected, [aria-pressed="true"]):active {
    border-color: var(--deeptask-color-glass-border-active);
    background: var(--deeptask-color-glass-background-active);
    color: var(--deeptask-color-text);
    box-shadow: var(--deeptask-glass-shadow-active);
    transform: none;
}

.deeptask-scope .dt-btn:disabled,
.deeptask-scope .dt-btn[aria-disabled="true"] {
    border-color: var(--deeptask-color-glass-border);
    background: var(--deeptask-color-disabled-bg);
    color: var(--deeptask-color-text-disabled);
    box-shadow: none;
    opacity: 0.65;
    cursor: not-allowed;
    pointer-events: none;
}

/* Semantic CTA buttons */
.deeptask-scope .dt-btn--primary {
    border-color: var(--deeptask-color-primary);
    background: var(--deeptask-color-primary);
    color: var(--deeptask-color-text-on-primary);
}

@media (hover: hover) {
    .deeptask-scope .dt-btn--primary:not(:disabled):not(.is-active):not(.active):not([aria-pressed="true"]):not(:focus-visible):not(:active):hover {
        border-color: var(--deeptask-color-primary-hover);
        background: var(--deeptask-color-primary-hover);
        color: var(--deeptask-color-text-on-primary);
        box-shadow: var(--deeptask-glass-shadow-hover);
    }
}

.deeptask-scope .dt-btn--primary:not(:disabled):is(:focus-visible, :active, .is-active, [aria-pressed="true"]),
.deeptask-scope .dt-btn--primary:is(.is-active, [aria-pressed="true"]):hover {
    border-color: var(--deeptask-color-primary);
    background: var(--deeptask-color-primary);
    color: var(--deeptask-color-text-on-primary);
    box-shadow: var(--deeptask-glass-shadow-active);
}

.deeptask-scope .dt-btn--danger {
    border-color: var(--deeptask-color-danger);
    background: var(--deeptask-color-danger-surface);
    color: var(--deeptask-color-danger);
}

@media (hover: hover) {
    .deeptask-scope .dt-btn--danger:not(:disabled):not(.is-active):not([aria-pressed="true"]):not(:focus-visible):not(:active):hover {
        border-color: var(--deeptask-color-danger-bright);
        background: var(--deeptask-color-danger-soft);
        color: var(--deeptask-color-danger);
        box-shadow: none;
    }
}

.deeptask-scope .dt-btn--success {
    border-color: var(--deeptask-color-success);
    background: var(--deeptask-color-success-surface);
    color: var(--deeptask-color-success);
}

@media (hover: hover) {
    .deeptask-scope .dt-btn--success:not(:disabled):not(.is-active):not([aria-pressed="true"]):not(:focus-visible):not(:active):hover {
        border-color: var(--deeptask-color-success-bright);
        background: var(--deeptask-color-success-soft);
        color: var(--deeptask-color-success);
        box-shadow: none;
    }
}

/* ── 3. Canonical Binary Toggle Switches (1:1 EMODIBOK Switch Contract) ── */
.deeptask-scope .dt-toggle-field {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    min-height: var(--deeptask-control-height);
    cursor: pointer;
    user-select: none;
    font-family: var(--deeptask-font-regular);
    font-size: var(--deeptask-font-size);
    font-weight: 400;
    color: var(--deeptask-color-text);
}

.deeptask-scope .dt-toggle__input {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

/* OFF state: attention orange rim + glow, knob on left */
.deeptask-scope .dt-toggle__switch {
    box-sizing: border-box;
    position: relative;
    display: inline-flex;
    flex: 0 0 52px;
    align-items: center;
    justify-content: flex-start;
    width: 52px;
    min-width: 52px;
    height: 30px;
    min-height: 30px;
    padding: 3px;
    border: 1px solid var(--deeptask-color-glass-border-active);
    border-radius: var(--deeptask-radius-pill);
    background: var(--deeptask-color-glass-background);
    color: var(--deeptask-color-text);
    box-shadow: var(--deeptask-glass-shadow-active);
    overflow: hidden;
    transition: background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.deeptask-scope .dt-toggle__switch::after {
    content: '';
    display: block;
    width: 22px;
    height: 22px;
    border-radius: var(--deeptask-radius-pill);
    background: var(--deeptask-color-text);
    box-shadow: 0 1px 2px var(--deeptask-color-shadow);
    transform: translateX(0);
    transition: transform 160ms ease, background-color 160ms ease;
}

/* OFF hover: crisp neutral hover rim/bg (no glow) */
@media (hover: hover) {
    .deeptask-scope .dt-toggle-field:hover .dt-toggle__input:not(:checked):not(:disabled)+.dt-toggle__switch {
        border-color: var(--deeptask-color-hover-border);
        background: var(--deeptask-color-hover-bg);
        box-shadow: var(--deeptask-glass-shadow-hover);
    }
}

/* ON state: solid primary, NO glow, white thumb shifted right. Hover has ZERO effect! */
.deeptask-scope .dt-toggle__input:checked+.dt-toggle__switch,
.deeptask-scope .dt-toggle-field:hover .dt-toggle__input:checked+.dt-toggle__switch,
.deeptask-scope .dt-toggle-field:active .dt-toggle__input:checked+.dt-toggle__switch {
    border-color: var(--deeptask-color-primary);
    background: var(--deeptask-color-primary);
    color: var(--deeptask-color-text-on-primary);
    box-shadow: none;
}

.deeptask-scope .dt-toggle__input:checked+.dt-toggle__switch::after {
    background: var(--deeptask-color-text-on-primary);
    transform: translateX(22px);
}

.deeptask-scope .dt-toggle__input:focus-visible+.dt-toggle__switch {
    outline: none;
    box-shadow: var(--deeptask-glass-shadow-active);
}

.deeptask-scope .dt-toggle__input:disabled+.dt-toggle__switch {
    border-color: var(--deeptask-color-glass-border);
    background: var(--deeptask-color-disabled-bg);
    box-shadow: none;
    opacity: 0.65;
    cursor: not-allowed;
}

.deeptask-scope .dt-toggle__label {
    line-height: 1.35;
}

/* ── 4. Cards, Badges, Fields & Modals ────────────────────────────────── */
.deeptask-scope .dt-card {
    padding: var(--deeptask-card-padding);
    border: 1px solid var(--deeptask-card-border);
    border-radius: var(--deeptask-radius);
    background: var(--deeptask-card-bg);
    box-shadow: var(--deeptask-shadow-sm);
}

.deeptask-scope .dt-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    flex-shrink: 0;
    width: auto;
    max-width: 100%;
    height: var(--deeptask-badge-height);
    min-height: var(--deeptask-badge-height);
    padding: 0 14px;
    border: 0;
    border-radius: var(--deeptask-radius-pill);
    background: var(--deeptask-color-inset);
    color: var(--deeptask-color-text-muted);
    font-family: var(--deeptask-font-emphasis);
    font-size: var(--deeptask-font-size);
    font-weight: 400;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-sizing: border-box;
}

.deeptask-scope .dt-badge--primary {
    background: var(--deeptask-color-primary-soft);
    color: var(--deeptask-color-primary-ink);
}

.deeptask-scope .dt-badge--success {
    background: var(--deeptask-color-success-surface);
    color: var(--deeptask-color-success);
}

.deeptask-scope .dt-badge--warning {
    background: var(--deeptask-color-warning-surface);
    color: var(--deeptask-color-warning);
}

.deeptask-scope .dt-badge--danger {
    background: var(--deeptask-color-danger-surface);
    color: var(--deeptask-color-danger);
}

.deeptask-scope .dt-badge--info {
    background: var(--deeptask-color-info-surface);
    color: var(--deeptask-color-info);
}

.deeptask-scope .dt-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.deeptask-scope .dt-field__label {
    font-family: var(--deeptask-font-emphasis);
    font-size: var(--deeptask-font-size);
    font-weight: 400;
    color: var(--deeptask-color-text);
}

.deeptask-scope .dt-field__hint {
    font-family: var(--deeptask-font-regular);
    font-size: var(--deeptask-font-size);
    font-weight: 400;
    color: var(--deeptask-color-text-soft);
}

.deeptask-scope .dt-modal {
    position: fixed;
    inset: 0;
    z-index: 100100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.deeptask-scope .dt-modal__backdrop {
    position: absolute;
    inset: 0;
    background: var(--deeptask-color-overlay);
}

.deeptask-scope .dt-modal__dialog {
    position: relative;
    z-index: 1;
    width: min(860px, 100%);
    max-height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
    border: 1px solid var(--deeptask-color-border);
    border-radius: var(--deeptask-radius-lg);
    background: var(--deeptask-color-popup-bg);
    box-shadow: var(--deeptask-shadow-lg);
    overflow: hidden;
}

.deeptask-scope .dt-modal__dialog--wide {
    width: min(1140px, 100%);
}

.deeptask-scope .dt-modal__head,
.deeptask-scope .dt-modal__foot {
    padding: 16px 20px;
    border-bottom: 1px solid var(--deeptask-color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.deeptask-scope .dt-modal__head--centered {
    justify-content: center;
    min-height: 52px;
    padding: 12px 20px;
}

.deeptask-scope .dt-modal__head--centered .dt-card__title {
    margin: 0;
    font-family: var(--deeptask-font-emphasis);
    font-size: var(--deeptask-font-size);
    font-weight: 400;
    line-height: 1.3;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-align: center;
    color: var(--deeptask-color-text);
}

.deeptask-scope .dt-modal__foot {
    border-bottom: 0;
    border-top: 1px solid var(--deeptask-color-border);
    justify-content: flex-end;
}

.deeptask-scope .dt-modal__body {
    padding: 20px;
    overflow-y: auto;
    flex: 1 1 auto;
}

@media (max-width: 767px) {
    .deeptask-scope .dt-modal {
        padding: 0;
        align-items: stretch;
    }

    .deeptask-scope .dt-modal__dialog,
    .deeptask-scope .dt-modal__dialog--wide {
        width: 100vw;
        width: 100dvw;
        max-width: none;
        height: 100vh;
        height: 100dvh;
        max-height: none;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .deeptask-scope .dt-modal__head,
    .deeptask-scope .dt-modal__foot {
        padding: 10px 14px;
    }

    .deeptask-scope .dt-modal__foot {
        padding-bottom: max(10px, env(safe-area-inset-bottom));
    }

    .deeptask-scope .dt-modal__body {
        padding: 14px;
    }
}

.deeptask-scope .dt-input-shell:has(> textarea.dt-input-control),
body.deeptask-admin-screen .deeptask-scope .dt-input-shell:has(> textarea.dt-input-control) {
    padding: 12px 6px 10px 0;
}

.deeptask-scope .dt-input-shell textarea.dt-input-control,
body.deeptask-admin-screen .deeptask-scope .dt-input-shell textarea.dt-input-control {
    height: auto;
    min-height: 64px;
    padding: 0 10px 0 14px;
    border-radius: 0;
    line-height: 1.5;
    resize: vertical;
}

.deeptask-scope :is(.dt-workspace__nav, .dt-explorer__tree, .dt-explorer__content, .dt-popup__body, [data-job-dialog="order"] > .dt-workspace__dialog-body, .dt-job-notes__body, [data-dt-ov-staff-body], [data-dt-ov-upcoming-body], [data-dt-ov-recent-body], [data-dt-ov-alerts-body], textarea, .dt-textarea) {
    scrollbar-width: thin;
    scrollbar-color: var(--deeptask-color-primary) var(--deeptask-color-transparent);
}

@supports selector(::-webkit-scrollbar) {
    .deeptask-scope :is(.dt-workspace__nav, .dt-explorer__tree, .dt-explorer__content, .dt-popup__body, [data-job-dialog="order"] > .dt-workspace__dialog-body, .dt-job-notes__body, [data-dt-ov-staff-body], [data-dt-ov-upcoming-body], [data-dt-ov-recent-body], [data-dt-ov-alerts-body], textarea, .dt-textarea) {
        scrollbar-width: auto;
        scrollbar-color: auto;
    }

    .deeptask-scope :is(.dt-workspace__nav, .dt-explorer__tree, .dt-explorer__content, .dt-popup__body, [data-job-dialog="order"] > .dt-workspace__dialog-body, .dt-job-notes__body, [data-dt-ov-staff-body], [data-dt-ov-upcoming-body], [data-dt-ov-recent-body], [data-dt-ov-alerts-body], textarea, .dt-textarea)::-webkit-scrollbar { width: 6px; height: 6px; }
    .deeptask-scope :is(.dt-workspace__nav, .dt-explorer__tree, .dt-explorer__content, .dt-popup__body, [data-job-dialog="order"] > .dt-workspace__dialog-body, .dt-job-notes__body, [data-dt-ov-staff-body], [data-dt-ov-upcoming-body], [data-dt-ov-recent-body], [data-dt-ov-alerts-body], textarea, .dt-textarea)::-webkit-scrollbar-track { background: var(--deeptask-color-transparent); }
    .deeptask-scope :is(.dt-workspace__nav, .dt-explorer__tree, .dt-explorer__content, .dt-popup__body, [data-job-dialog="order"] > .dt-workspace__dialog-body, .dt-job-notes__body, [data-dt-ov-staff-body], [data-dt-ov-upcoming-body], [data-dt-ov-recent-body], [data-dt-ov-alerts-body], textarea, .dt-textarea)::-webkit-scrollbar-corner { background: var(--deeptask-color-transparent); }
    .deeptask-scope :is(.dt-workspace__nav, .dt-explorer__tree, .dt-explorer__content, .dt-popup__body, [data-job-dialog="order"] > .dt-workspace__dialog-body, .dt-job-notes__body, [data-dt-ov-staff-body], [data-dt-ov-upcoming-body], [data-dt-ov-recent-body], [data-dt-ov-alerts-body], textarea, .dt-textarea)::-webkit-scrollbar-thumb {
        min-height: 24px;
        min-width: 24px;
        border-radius: 999px;
        background: var(--deeptask-color-primary);
    }
    .deeptask-scope :is(.dt-workspace__nav, .dt-explorer__tree, .dt-explorer__content, .dt-popup__body, [data-job-dialog="order"] > .dt-workspace__dialog-body, .dt-job-notes__body, [data-dt-ov-staff-body], [data-dt-ov-upcoming-body], [data-dt-ov-recent-body], [data-dt-ov-alerts-body], textarea, .dt-textarea)::-webkit-scrollbar-button { display: none; }
}

/* ── Async Notice / Status / Badge Pending REST Skeleton (100% tokenized) ─ */
@keyframes dt-pending-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.deeptask-scope [data-dt-pending="true"] {
    position: relative;
    color: var(--deeptask-color-transparent) !important;
    user-select: none;
    pointer-events: none;
    border-color: var(--deeptask-color-transparent) !important;
    background: linear-gradient(90deg, var(--deeptask-color-border) 0%, var(--deeptask-color-panel) 50%, var(--deeptask-color-border) 100%) !important;
    background-size: 200% 100% !important;
    animation: dt-pending-shimmer 1.35s ease-in-out infinite;
}

.deeptask-scope .dt-badge[data-dt-pending="true"] {
    min-width: 148px;
    height: var(--deeptask-badge-height);
    min-height: var(--deeptask-badge-height);
    border: 0 !important;
    border-radius: var(--deeptask-radius-pill);
}

.deeptask-scope :is(p, .dt-notice)[data-dt-pending="true"] {
    display: flex;
    align-items: center;
    min-height: 1.5em;
    background: var(--deeptask-color-transparent) !important;
    animation: none;
}

.deeptask-scope :is(p, .dt-notice)[data-dt-pending="true"]::before {
    content: "";
    display: block;
    width: min(40ch, 85%);
    height: 0.85em;
    border-radius: var(--deeptask-radius-sm);
    background: linear-gradient(90deg, var(--deeptask-color-border) 0%, var(--deeptask-color-panel) 50%, var(--deeptask-color-border) 100%);
    background-size: 200% 100%;
    animation: dt-pending-shimmer 1.35s ease-in-out infinite;
}

.deeptask-scope :is(dd, strong, span:not(.dt-badge))[data-dt-pending="true"] {
    display: inline-block;
    min-width: min(16ch, 100%);
    height: 0.85em;
    margin-block: calc((1.5em - 0.85em) / 2);
    border-radius: var(--deeptask-radius-sm);
    vertical-align: middle;
}

@media (prefers-reduced-motion: reduce) {
    .deeptask-scope [data-dt-pending="true"],
    .deeptask-scope :is(p, .dt-notice)[data-dt-pending="true"]::before {
        animation: none;
        background: var(--deeptask-color-border) !important;
    }
}
