body.work-edit-open, body.move-dialog-open { overflow: hidden; }
/* Keep fixed app surfaces below the shared work drawer and its nested tools. */
body.work-edit-open #messenger-app.has-conversation,
body.work-edit-open .ai-chat-widget { z-index: 980; }
.pm-overlay.work-edit-overlay {
    padding: 0;
    justify-content: flex-end;
    z-index: 990;
}
.work-edit-sidebar {
    display: flex;
    flex-direction: column;
    width: min(580px, 100%);
    height: 100dvh;
    max-width: 100%;
    max-height: 100dvh;
    border-radius: 0;
    overflow: hidden;
}
.work-edit-overlay:not([hidden]) .work-edit-sidebar {
    animation: work-edit-slide-in 0.3s ease-out;
}
@keyframes work-edit-slide-in {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}
@media (prefers-reduced-motion: reduce) {
    .work-edit-overlay:not([hidden]) .work-edit-sidebar { animation: none; }
}
.work-edit-sidebar .pm-modal-header { flex-shrink: 0; gap: 1rem; }
.work-edit-sidebar .pm-modal-close { flex-shrink: 0; }
#work-edit-title { margin: 0; font-size: 1rem; overflow-wrap: anywhere; }
.work-edit-content { padding: 1rem; overflow-y: auto; min-height: 0; flex: 1; display: flex; flex-direction: column; }
.work-edit-content form { max-width: 100%; }
.work-edit-sidebar .select2-container { max-width: 100%; }
.pm-overlay.work-tools-overlay { z-index: 1000; }
.work-tools-overlay .dependency-content { overflow-y: auto; min-height: 0; }
.work-edit-content .simple-form input[type="checkbox"],
.work-edit-content .simple-form input[type="radio"] { width: auto; }
.work-edit-content .form-field > div { max-width: 100%; }
.work-edit-content [data-work-form-get] {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--color-border);
}

.work-panel-tools,.work-panel-meta {display:flex;flex-wrap:wrap;gap:.6rem;align-items:center;margin-bottom:1rem;}
.work-panel-section {padding:.8rem;margin-block:1rem;border:1px solid var(--color-border);border-radius:.6rem;}
.work-panel-section summary {cursor:pointer;font-weight:600;}
.work-panel-section label {display:block;}
.work-panel-section textarea {width:100%;box-sizing:border-box;}
.work-panel-text {white-space:pre-wrap;overflow-wrap:anywhere;}
.work-panel-description {overflow-wrap:anywhere;line-height:1.9;}
.work-panel-description img {max-width:100%;}
.work-panel-description pre {overflow:auto;}

.work-panel-section summary { display: flex; align-items: center; gap: .5rem; list-style: none; }
.work-panel-section summary::-webkit-details-marker { display: none; }
.work-panel-section summary::after { content: '⌄'; margin-inline-start: auto; color: var(--color-muted); }
.work-panel-section[open] > summary::after { transform: rotate(180deg); }
.work-panel-section .comment-item { border: 1px solid var(--color-border); border-radius: 8px; margin-block: .6rem; padding: .7rem; }
.work-edit-sidebar .dependency-content { padding: .5rem 0; }
.work-edit-sidebar .dependency-content h2 { font-size: .9rem; }
.person-select-dropdown .select2-results__options { max-height: min(240px, 50vh); }
.person-select-dropdown .select2-results__option { min-height: 2.25rem; box-sizing: border-box; }
.work-edit-content > * { flex-shrink: 0; }
.work-edit-content .work-edit-move { display: inline-flex; align-items: center; gap: .5rem; inline-size: auto; block-size: auto; min-height: 2.4rem; padding: .45rem .75rem; }
.work-edit-footer { position: sticky; bottom: -1rem; z-index: 2; display: flex; direction: ltr; justify-content: flex-start; gap: .5rem; margin-top: auto; padding-block: .8rem; background: var(--color-surface); border-top: 1px solid var(--color-border); }
.work-edit-icon { display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box; width: 36px; height: 36px; flex: 0 0 36px; padding: 0; border: 1px solid currentColor; border-radius: 7px; background: var(--color-surface-alt); cursor: pointer; text-decoration: none; }
.work-edit-icon .ui-icon { width: 19px; height: 19px; }
.work-edit-save { color: var(--color-primary); }
.work-edit-cancel { color: var(--color-muted); }
.work-edit-delete { color: var(--color-danger); }
.work-edit-icon:hover { background: var(--color-focus-ring); }
.work-edit-icon:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.work-edit-icon:disabled { opacity: .5; cursor: wait; }
@media (max-width: 760px) {
    .work-edit-icon { width: 44px; height: 44px; flex-basis: 44px; }
    /* Phones have no hover titles, so the main action is spelled out and fills the rest of the bar. */
    .work-edit-save { width: auto; flex: 1 1 auto; gap: .4rem; padding-inline: 1rem; border-color: var(--color-primary); background: var(--color-primary); color: var(--color-primary-contrast); }
    .work-edit-save:hover { background: var(--color-primary-dark); }
    .work-edit-save::after { content: 'ذخیره'; font-weight: 600; }
}

/* One drawer keeps each work tool in its own accessible tab. */
.work-edit-content [hidden] { display: none !important; }
.work-panel-tabs { display: flex; flex-wrap: wrap; gap: .5rem; position: sticky; top: -1rem; z-index: 3; padding-block: .65rem; margin-block: -1rem .8rem; background: var(--color-surface); border-bottom: 1px solid var(--color-border); }
.work-panel-tab { position: relative; display: inline-grid; place-items: center; width: 42px; height: 42px; padding: 0; border: 1px solid var(--color-border); border-radius: 7px; color: var(--color-muted); background: var(--color-surface-alt); cursor: pointer; }
.work-panel-tab[aria-selected=true] { color: var(--color-primary); border-color: var(--color-primary); background: var(--color-focus-ring); }
.work-panel-tab:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.work-panel-tab .badge { position: absolute; inset-inline-end: -5px; top: -5px; display: grid; place-items: center; min-width: 16px; height: 16px; padding: 0 3px; border-radius: 10px; background: var(--color-surface-alt); border: 1px solid var(--color-border); color: var(--color-muted); font-size: .6rem; }
.work-pane-title { margin-block: 0 .9rem; font-size: .95rem; }
.work-tab-pane > .work-panel-section, .work-tab-pane > .work-hours-report > .work-panel-section { border: 0; padding: 0; margin-block: .7rem; }
.work-tab-pane > .work-panel-section > summary, .work-tab-pane > .work-hours-report > .work-panel-section > summary { display: none; }
.work-tab-pane .work-panel-section ul { padding-inline-start: 1.3rem; }
.work-edit-sidebar .pm-modal-close { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 7px; }
.work-edit-sidebar .pm-modal-close .ui-icon { width: 20px; height: 20px; }
@media (max-width: 760px) {
    .work-panel-tab { width: 40px; height: 40px; }
    .work-edit-save { width: 44px; flex: 0 0 44px; padding: 0; background: var(--color-surface-alt); color: var(--color-primary); }
    .work-edit-save::after { content: none; }
}
.work-tab-pane textarea { box-sizing: border-box; width: 100%; padding: .6rem; border: 1px solid var(--color-border); border-radius: 7px; color: var(--color-text); background: var(--color-surface-alt); font: inherit; resize: vertical; }
