dialog.responsive-dialog {
    position: fixed;
    inset: 0;
    width: min(440px, calc(100vw - 48px));
    max-width: none;
    max-height: calc(100dvh - 48px);
    margin: auto;
    padding: 24px 22px 20px;
    overflow-y: auto;
    border: 0;
    border-radius: 20px;
    background: var(--surface);
    color: var(--ink);
    box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .4);
    animation: responsive-dialog-enter .2s ease-out;
}

dialog.responsive-dialog::backdrop {
    background: rgba(20, 18, 15, .42);
    animation: responsive-dialog-backdrop .2s ease-out;
}

.responsive-dialog-mobile-header {
    display: none;
}

.responsive-dialog h3 {
    margin: 0 0 18px;
    font-size: 17px;
    font-weight: 600;
    text-align: center;
}

dialog.responsive-dialog.task-details-dialog {
    width: min(760px, calc(100vw - 40px));
    min-height: min(640px, calc(100dvh - 40px));
    max-height: calc(100dvh - 40px);
    padding: 0;
}

.task-dialog-header {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding: 24px 28px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.task-dialog-title {
    flex: 1;
    min-width: 0;
}

.task-dialog-actions {
    display: flex;
    align-items: center;
    flex: none;
    gap: 8px;
}

.task-dialog-eyebrow {
    color: var(--ink-soft);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.task-dialog-header h2 {
    margin: 5px 0 0;
    font-size: 24px;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.task-dialog-header.task-dialog-task-row {
    position: relative;
    align-items: center;
    gap: 8px;
    padding: 10px 13px;
    cursor: default;
}

.task-dialog-header.task-dialog-task-row h2 {
    margin: 0;
    font-size: 13px;
    cursor: default;
}

.task-dialog-header.task-dialog-task-row .task-card-description {
    margin: 5px 0 0;
    font-size: 12px;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.task-dialog-task-row .task-card-assign {
    display: inline-flex;
    min-width: 0;
    max-width: 100%;
}

.task-dialog-task-row .task-dialog-action,
.task-dialog-task-row .task-dialog-close {
    width: 32px;
    height: 32px;
}

.task-dialog-action,
.task-dialog-close {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--ink);
    cursor: pointer;
}

.task-dialog-action {
    border-radius: 10px;
}

.task-dialog-action svg {
    width: 18px;
    height: 18px;
}

.task-dialog-action:hover {
    background: var(--border);
}

.task-dialog-action.task-dialog-delete {
    border-color: #D6362C;
    color: #D6362C;
}

.task-dialog-action.task-dialog-delete:hover {
    background: #F3DAD7;
}

.task-dialog-action:focus-visible,
.task-dialog-close:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.task-dialog-close {
    border-radius: 50%;
    font-size: 22px;
    line-height: 1;
}

.task-dialog-body {
    display: grid;
    gap: 20px;
    padding: 24px 28px 32px;
}

.task-details-tablist {
    display: flex;
    border-bottom: 1px solid var(--border);
}

.task-details-tablist [role="tab"] {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex: 1;
    min-width: 0;
    padding: 14px 8px;
    border: 0;
    border-bottom: 2px solid transparent;
    background: none;
    color: var(--ink-soft);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.task-details-tablist [aria-selected="true"] {
    border-bottom-color: var(--accent);
    color: var(--accent);
}

.task-details-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    box-sizing: border-box;
    padding: 0 5px;
    border-radius: 10px;
    background: var(--surface-soft);
    color: var(--ink-soft);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

.task-details-count.unread {
    background: var(--accent);
    color: var(--surface);
}

.task-details-tablist [role="tab"]:focus-visible,
.task-details-tab-panel:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -3px;
}

.task-details-tab-viewport {
    overflow: hidden;
    touch-action: pan-y pinch-zoom;
}

.task-details-tab-track {
    display: flex;
    align-items: flex-start;
    transform: translateX(calc(var(--task-tab-index, 0) * -100% + var(--task-tab-drag, 0px)));
    transition: transform .2s ease;
}

.task-details-tab-panel {
    flex: 0 0 100%;
    min-width: 0;
    min-height: 160px;
    box-sizing: border-box;
    padding: 24px 28px 32px;
    overflow-wrap: anywhere;
}

.task-details-tabs.dragging .task-details-tab-track {
    transition: none;
    cursor: grabbing;
    user-select: none;
}

.task-details-dialog .task-dialog-section h3 {
    margin: 0 0 12px;
    color: var(--ink);
    font-size: 16px;
    font-weight: 700;
    text-align: left;
}

.task-dialog-section + .task-dialog-section {
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.task-details-dialog .task-card-detail-row {
    padding: 0 0 12px;
    font-size: 13px;
}

.task-details-dialog .task-card-description {
    font-size: 14px;
    line-height: 1.5;
}

.task-details-dialog .note-panel {
    background: transparent;
}

.task-details-dialog .note-add-links {
    justify-content: flex-end;
}

@keyframes responsive-dialog-enter {
    from { opacity: 0; transform: translateY(8px) scale(.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes responsive-dialog-backdrop {
    from { background: rgba(20, 18, 15, 0); }
    to { background: rgba(20, 18, 15, .42); }
}

@media (max-width: 767px) {
    dialog.responsive-dialog[open] {
        inset: var(--vvtop, 0px) 0 auto;
        width: 100%;
        height: var(--vvh, 100dvh);
        min-height: 0;
        max-height: var(--vvh, 100dvh);
        margin: 0;
        padding: 0 20px calc(20px + env(safe-area-inset-bottom));
        border-radius: 0;
        animation: responsive-sheet-enter .25s ease-out;
    }

    body.clavier-ouvert dialog.responsive-dialog[open] {
        top: var(--vvtop, 0px);
        height: var(--vvh, 100dvh);
        max-height: var(--vvh, 100dvh);
    }

    dialog.responsive-dialog::before {
        display: none;
    }

    .responsive-dialog-mobile-header {
        position: sticky;
        top: 0;
        z-index: 2;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 16px;
        min-height: 60px;
        margin: 0 -20px 20px;
        padding: max(12px, env(safe-area-inset-top)) 20px 12px;
        border-bottom: 1px solid var(--border);
        background: var(--surface);
    }

    .responsive-dialog-mobile-header h2 {
        min-width: 0;
        margin: 0;
        font-size: 17px;
        line-height: 1.3;
        overflow-wrap: anywhere;
    }

    .responsive-dialog-mobile-header button {
        flex: none;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        padding: 0;
        border: 1px solid var(--border);
        border-radius: 50%;
        background: var(--bg);
        color: var(--ink);
        font-size: 22px;
        line-height: 1;
        cursor: pointer;
    }

    .responsive-dialog-mobile-header + h3 {
        display: none;
    }

    dialog.responsive-dialog.activity-editor-dialog[open] {
        width: 100%;
        height: var(--vvh, 100dvh);
        max-height: var(--vvh, 100dvh);
        padding: 0;
    }

    .activity-editor-header {
        padding-top: max(8px, env(safe-area-inset-top));
    }

    dialog.responsive-dialog.task-details-dialog {
        width: 100%;
        height: var(--vvh, 100dvh);
        min-height: 0;
        max-height: var(--vvh, 100dvh);
        padding: 0 0 env(safe-area-inset-bottom);
    }

    .feedback-dialog-header,
    .task-dialog-header,
    .messages-panel .notif-header {
        padding-top: max(12px, env(safe-area-inset-top));
    }

    .task-dialog-header {
        padding: max(16px, env(safe-area-inset-top)) 20px 16px;
    }

    .task-dialog-header h2 {
        font-size: 20px;
    }

    .task-dialog-body {
        padding: 20px;
    }

    .task-details-tab-panel {
        padding: 20px;
    }

    dialog.responsive-dialog.messages-dialog[open] {
        width: 100%;
        height: var(--vvh, 100dvh);
        max-height: var(--vvh, 100dvh);
        padding: 0 0 env(safe-area-inset-bottom);
    }

    .messages-panel .notif-header h2 {
        order: 1;
    }

    .messages-panel .notif-header .notif-back {
        order: 2;
    }

    .messages-close {
        order: 3;
    }

    @keyframes responsive-sheet-enter {
        from { transform: translateY(100%); }
        to { transform: translateY(0); }
    }
}

@media (prefers-reduced-motion: reduce) {
    dialog.responsive-dialog,
    dialog.responsive-dialog::backdrop {
        animation: none;
    }

    .task-details-tab-track {
        transition: none;
    }
}
