/* Control workspace layout and responsive behavior. */
.control-mobile-queue-nav,
.mobile-task-nav,
.control-focus-mobile-open,
.control-dashboard-secondary-toggle {
    display: none;
}

.control-list-filter-toggle {
    display: none;
}

.control-list-filter-content {
    display: grid;
    gap: 1.25rem;
}

.control-queue-summary,
.control-detail-state {
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    background: #ffffff;
    padding: 0.875rem 1rem;
}

.control-task-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.control-detail-layout {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(18rem, 1fr);
    gap: 1.25rem;
}

.control-detail-actions {
    grid-column: 2;
    grid-row: 1;
}

.control-detail-main {
    grid-column: 1;
    grid-row: 1 / span 2;
}

.control-detail-aside {
    grid-column: 2;
    grid-row: 2;
}

.control-detail-cancel {
    border-top: 1px solid #e2e8f0;
}

.control-detail-cancel summary {
    display: flex;
    min-height: 2.75rem;
    align-items: center;
    color: #b91c1c;
    font-size: 0.875rem;
    font-weight: 750;
    cursor: pointer;
}

.control-detail-cancel summary::-webkit-details-marker {
    display: none;
}

.control-detail-cancel summary::after {
    margin-left: auto;
    content: "+";
    font-size: 1.15rem;
    font-weight: 500;
}

.control-detail-cancel[open] summary::after {
    content: "−";
}

.control-detail-cancel summary:focus-visible {
    outline: 3px solid rgb(185 28 28 / 0.3);
    outline-offset: 2px;
}

.control-detail-cancel .btn-secondary {
    border-color: #fecaca;
    background: #fff7f7;
    color: #b91c1c;
}

.control-detail-main,
.control-detail-aside {
    display: grid;
    align-content: start;
    gap: 1.25rem;
    min-width: 0;
}

@keyframes controlQueueEnter {
    from {
        opacity: 0;
        transform: translateY(0.4rem);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 767px) {
    body.has-mobile-task-nav {
        padding-bottom: 4.75rem;
    }

    body.has-mobile-task-nav footer {
        display: none;
    }

    body.has-mobile-task-nav main {
        padding-top: 1rem !important;
        padding-bottom: 1.25rem !important;
    }

    .control-desktop-only {
        display: none !important;
    }

    .control-dashboard-secondary-toggle {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        min-height: 2.75rem;
        border-top: 1px solid #cbd5e1;
        border-bottom: 1px solid #cbd5e1;
        color: #334155;
        font-size: 0.875rem;
        font-weight: 800;
    }

    .control-dashboard:not(.is-secondary-open) .control-dashboard-secondary {
        display: none !important;
    }

    .control-dashboard-secondary-toggle:focus-visible,
    .control-list-filter-toggle:focus-visible,
    .mobile-task-nav a:focus-visible,
    .control-mobile-queue-nav a:focus-visible {
        outline: 3px solid rgb(37 99 235 / 0.45);
        outline-offset: 2px;
    }

    .control-focus-panel {
        border: 0;
        border-radius: 0;
        background: transparent;
        padding: 0;
        box-shadow: none;
    }

    .control-focus-panel .section-subtitle {
        display: none;
    }

    .control-focus-grid {
        gap: 0.625rem;
    }

    .control-focus-card {
        padding: 0.875rem;
    }

    .control-focus-button,
    .control-focus-link,
    .control-focus-detail-action {
        min-height: 2.75rem;
    }

    .control-focus-comment-action {
        display: none;
    }

    .control-focus-return-link {
        display: none;
    }

    .control-focus-mobile-open {
        display: inline-flex;
        align-items: center;
        min-height: 2.75rem;
        padding-inline: 0.625rem;
        color: #1d4ed8;
        font-size: 0.8125rem;
        font-weight: 800;
    }

    .control-dashboard-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        width: 100%;
    }

    .control-dashboard-actions > * {
        width: 100%;
    }

    .control-list-header-actions {
        display: none;
    }

    .control-mobile-queue-nav {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        border-top: 1px solid #e2e8f0;
        border-bottom: 1px solid #e2e8f0;
        background: rgb(255 255 255 / 0.55);
    }

    .control-mobile-queue-nav a {
        min-width: 0;
        padding: 0.75rem 0.25rem;
        text-align: center;
        color: #52617a;
    }

    .control-mobile-queue-nav a + a {
        border-left: 1px solid #e2e8f0;
    }

    .control-mobile-queue-nav strong,
    .control-mobile-queue-nav span {
        display: block;
    }

    .control-mobile-queue-nav strong {
        color: #0f172a;
        font-size: 1.125rem;
        line-height: 1.25rem;
    }

    .control-mobile-queue-nav span {
        margin-top: 0.2rem;
        overflow: hidden;
        font-size: 0.6875rem;
        font-weight: 700;
        text-overflow: ellipsis;
    }

    .control-mobile-queue-nav .is-alert strong,
    .control-mobile-queue-nav .is-alert span {
        color: #b91c1c;
    }

    .control-dashboard-worklists {
        gap: 1rem;
    }

    .control-dashboard-primary-queue,
    .control-dashboard-worklists > section {
        border: 0;
        border-radius: 0;
        padding: 0;
        box-shadow: none;
    }

    .control-list-scope {
        display: flex;
        gap: 0.25rem;
        margin-inline: -1rem;
        padding-inline: 1rem;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .control-list-scope::-webkit-scrollbar {
        display: none;
    }

    .control-list-scope a {
        flex: 0 0 auto;
        min-width: 7.25rem;
        border: 0;
        border-radius: 0;
        border-bottom: 2px solid transparent;
        background: transparent;
        padding: 0.625rem 0.25rem;
        box-shadow: none;
    }

    .control-list-scope a[aria-current="page"] {
        border-bottom-color: #2563eb;
        background: transparent;
    }

    .control-list-scope a > div:last-child {
        display: none;
    }

    .control-list-filters {
        border-top: 1px solid #e2e8f0;
        border-bottom: 1px solid #e2e8f0;
    }

    .control-list-filter-toggle {
        display: flex;
        align-items: center;
        justify-content: space-between;
        min-height: 2.75rem;
        color: #334155;
        font-size: 0.875rem;
        font-weight: 800;
        cursor: pointer;
    }

    .control-list-filter-toggle::after {
        content: "+";
        color: #52617a;
        font-size: 1.25rem;
        font-weight: 400;
    }

    .control-list-filters.is-open .control-list-filter-toggle::after {
        content: "−";
    }

    .control-list-filters:not(.is-open) .control-list-filter-content {
        display: none;
    }

    .control-filter-active {
        margin-left: auto;
        margin-right: 0.75rem;
        color: #2563eb;
        font-size: 0.6875rem;
    }

    .control-list-filter-content {
        gap: 0.75rem;
        padding-bottom: 1rem;
    }

    .control-list-filter-content .control-domain-grid {
        display: flex;
        gap: 0.5rem;
        overflow-x: auto;
        padding-bottom: 0.25rem;
    }

    .control-list-filter-content .control-domain-grid a {
        flex: 0 0 9rem;
    }

    .control-list-filter-content .section-card {
        border: 0;
        padding: 0;
        box-shadow: none;
    }

    .control-queue-summary {
        border: 0;
        border-radius: 0;
        padding: 0.25rem 0;
        background: transparent;
    }

    .control-queue-summary .btn-secondary,
    .control-queue-summary .text-sm.text-gray-500,
    .control-queue-summary > .mt-3 {
        display: none;
    }

    .control-task-list {
        gap: 0;
    }

    .control-task-row {
        gap: 0.625rem;
        border: 0;
        border-bottom: 1px solid #e2e8f0;
        border-radius: 0;
        padding: 1rem 0;
        box-shadow: none;
        animation: controlQueueEnter 0.28s ease-out both;
    }

    .control-task-row:nth-child(2) { animation-delay: 0.035s; }
    .control-task-row:nth-child(3) { animation-delay: 0.07s; }
    .control-task-row:nth-child(4) { animation-delay: 0.105s; }
    .control-task-row:nth-child(5) { animation-delay: 0.14s; }

    .control-task-row:hover {
        border-color: #e2e8f0;
        box-shadow: none;
        transform: none;
    }

    .control-task-heading {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: start;
        gap: 0.5rem;
    }

    .control-task-title {
        font-size: 1rem;
        line-height: 1.35rem;
    }

    .control-task-status {
        white-space: nowrap;
    }

    .control-task-priority {
        grid-column: 2;
    }

    .control-mobile-muted-chip {
        display: none;
    }

    .control-task-meta {
        margin-top: 0.3rem;
        font-weight: 500;
    }

    .control-task-next {
        margin-top: 0.45rem;
        font-size: 0.8125rem;
    }

    .control-task-row-main > .mt-2 {
        display: none;
    }

    .control-task-row-side {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
    }

    .control-task-due,
    .control-task-checklist {
        border: 0;
        background: transparent;
        padding: 0;
    }

    .control-task-due span,
    .control-task-checklist span {
        font-size: 0.8125rem;
    }

    .control-task-due small {
        display: inline;
        margin-left: 0.25rem;
    }

    .control-task-checklist {
        min-width: 6rem;
        text-align: right;
    }

    .control-task-checklist progress {
        height: 0.25rem;
        margin-top: 0.3rem;
    }

    .control-task-checklist-empty {
        display: none;
    }

    .control-detail-summary {
        gap: 0;
        border-top: 1px solid #e2e8f0;
        border-bottom: 1px solid #e2e8f0;
    }

    .control-detail-next,
    .control-detail-metric {
        border: 0;
        border-radius: 0;
        background: transparent;
        padding: 0.75rem 0;
        box-shadow: none;
    }

    .control-detail-metrics {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0.5rem;
        border-top: 1px solid #e2e8f0;
    }

    .control-detail-value {
        font-size: 0.9375rem;
        line-height: 1.25rem;
    }

    .control-detail-hint {
        font-size: 0.6875rem;
        line-height: 0.95rem;
    }

    .control-detail-state,
    .control-detail-dashboard-link {
        display: none;
    }

    .control-detail-layout {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .control-detail-actions,
    .control-detail-main,
    .control-detail-aside {
        grid-column: 1;
        grid-row: auto;
    }

    .control-detail-actions {
        border-color: #bfdbfe;
        background: #eff6ff;
    }

    .mobile-task-nav {
        position: fixed;
        z-index: 80;
        right: 0;
        bottom: 0;
        left: 0;
        display: flex;
        align-items: flex-end;
        justify-content: space-around;
        min-height: 4.25rem;
        padding: 0.4rem max(0.5rem, env(safe-area-inset-right)) max(0.4rem, env(safe-area-inset-bottom)) max(0.5rem, env(safe-area-inset-left));
        border-top: 1px solid #e2e8f0;
        background: rgb(255 255 255 / 0.96);
        box-shadow: 0 -8px 24px rgb(15 23 42 / 0.08);
        backdrop-filter: blur(12px);
    }

    .mobile-task-nav a {
        display: grid;
        min-width: 3.5rem;
        min-height: 2.75rem;
        justify-items: center;
        gap: 0.15rem;
        color: #52617a;
        font-size: 0.625rem;
        font-weight: 750;
    }

    .mobile-task-nav a[aria-current="page"] {
        color: #1d4ed8;
    }

    .mobile-task-nav-icon {
        display: grid;
        place-items: center;
        width: 1.75rem;
        height: 1.75rem;
        font-size: 1.2rem;
        line-height: 1;
    }

    .mobile-task-nav-icon svg {
        width: 1.35rem;
        height: 1.35rem;
        fill: none;
        stroke: currentColor;
        stroke-width: 1.8;
        stroke-linecap: round;
        stroke-linejoin: round;
    }

    .mobile-task-nav-create .mobile-task-nav-icon {
        width: 2.5rem;
        height: 2.5rem;
        margin-top: -1rem;
        border-radius: 999px;
        background: #2563eb;
        color: #ffffff;
        box-shadow: 0 5px 14px rgb(37 99 235 / 0.3);
    }
}

@media (prefers-reduced-motion: reduce) {
    .control-task-row {
        animation: none;
    }
}
