@media (max-width: 760px) {
  .sidebar.backend-mobile-open {
    display: flex;
    position: fixed;
    inset: 0 auto 0 0;
    width: min(280px, 85vw);
    z-index: 20;
  }
}

.attachment-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.attachment-card > span { display: grid; gap: 3px; }
.attachment-card small { color: var(--muted); }
.template-editor { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.template-item-editor { display: grid; gap: 8px; padding: 12px; margin: 8px 0; border: 1px solid var(--line); border-radius: 7px; }
.template-item-editor label { display: grid; gap: 4px; }
.step-title-form { margin: 0; }
.step-completed .step-title-input,
.step-completed .step-title-text { text-decoration: line-through; opacity: .72; }
.task-event-badge { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.audit + .audit { margin-top: 8px; }
.audit small { display: block; margin-top: 2px; color: var(--muted); }
.priority-badge { border-radius: 999px; padding: 1px 6px; background: var(--bg); }
.priority-high { color: var(--danger); font-weight: 700; }
.priority-low { opacity: .8; }
.recurrence-guidance { margin-bottom: 12px; padding: 10px; border-left: 3px solid var(--accent); background: var(--bg); border-radius: 5px; }
.recurrence-guidance p { margin: 4px 0 0; color: var(--muted); }
.recurrence-card { margin: 10px 0; padding: 10px; border: 1px solid var(--line); border-radius: 7px; }
.recurrence-summary { margin: 0 0 8px; font-weight: 650; }
.list-permission-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px 12px; }
.list-permission-rule { display: grid; gap: 3px; font-size: 12px; }
.list-permission-rule select { min-width: 0; width: 100%; padding: 6px; border: 1px solid var(--line); border-radius: 5px; background: var(--panel); }
.list-principal-rule { padding: 9px 0; border-bottom: 1px solid var(--line); }
#location-dialog select { width: 100%; margin-top: 5px; padding: 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); }
.toast.error { background: var(--danger); }
.toast-action { margin-left: 12px; border: 1px solid #ffffff80; border-radius: 5px; padding: 4px 8px; color: #fff; background: transparent; font-weight: 700; }
.toast-action:disabled { opacity: .55; cursor: wait; }
pre[data-backend-backup-preview] { max-height: 280px; overflow: auto; white-space: pre-wrap; background: var(--bg); padding: 10px; border-radius: 6px; }
:root[data-density="compact"] .task-row { min-height: 42px; }
:root[data-density="compact"] .card,
:root[data-density="compact"] .drawer-section { padding: 10px; }

.backend-task-row {
  grid-template-columns: 28px 28px minmax(0, 1fr) 36px 36px;
  overflow: visible;
}
.backend-sidebar-list { position: relative; }
.backend-sidebar-list .nav-button { padding-right: 38px; }
.backend-sidebar-list.has-list-drag .nav-button { padding-left: 38px; }
.backend-sidebar-list .sidebar-pin { position: absolute; float: none; right: 4px; top: 3px; margin: 0; }
.sidebar-list-drag { position: absolute; z-index: 2; left: 4px; top: 3px; width: 30px; min-height: 34px; padding: 0; border: 0; border-radius: 5px; background: transparent; color: #d7e8e4; cursor: grab; }
.sidebar-list-drag:active { cursor: grabbing; }
.sidebar-list-drag:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.backend-sidebar-list.list-dragging { opacity: .58; }
.backend-sidebar-list.list-reorder-target { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 6px; }
.sidebar-order-disabled { margin: 6px 0 0; color: #f3d39b; font-size: 11px; line-height: 1.35; }
.sidebar-more { color: #d7e8e4; font-size: 12px; }
.backend-task-row.selected { box-shadow: inset 3px 0 0 var(--accent); }
.backend-task-row .task-copy { min-width: 0; }
.backend-task-row .task-open-title { width: 100%; padding: 0; border: 0; background: transparent; color: inherit; text-align: left; }
.backend-task-row.dragging { opacity: .55; }
.backend-task-row.task-position-before { box-shadow: inset 0 3px 0 var(--accent); }
.backend-task-row.task-position-after { box-shadow: inset 0 -3px 0 var(--accent); }
.backend-task-row[aria-keyshortcuts]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.backend-task-toolbar,
.backend-bulk-toolbar {
  display: flex;
  align-items: end;
  gap: 9px;
  flex-wrap: wrap;
  margin: 10px 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
}
.backend-select-all { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; }
.backend-task-filter { display: grid; gap: 3px; color: var(--muted); font-size: 12px; }
.backend-task-filter input,
.backend-task-filter select,
.backend-bulk-toolbar select { min-height: 36px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); }
.backend-task-filter input { width: min(310px, 55vw); }
.backend-bulk-toolbar strong { margin-right: auto; }
.backend-bulk-toolbar label { display: inline-flex; align-items: center; gap: 6px; }
.backend-task-row .task-menu-wrap { position: relative; }
.backend-task-row .task-context-menu { z-index: 40; }
.task-activity { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); white-space: nowrap; }
.task-activity .activity-author { letter-spacing: .01em; }
.task-activity .activity-unread { display: inline-block; min-width: 1.15em; color: var(--accent); font-weight: 800; text-decoration: underline 2px; text-underline-offset: 2px; }
.activity-author { position: relative; cursor: pointer; border-radius: 4px; padding: 1px 2px; }
.activity-author:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
.activity-popover { display: none; position: absolute; z-index: 80; left: 0; top: calc(100% + 5px); width: min(360px, 70vw); max-height: 300px; overflow: auto; padding: 7px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--text); box-shadow: 0 8px 24px #0002; text-align: left; }
.activity-author:hover .activity-popover,
.activity-author:focus-within .activity-popover,
.activity-author.touch-preview-open .activity-popover { display: grid; gap: 5px; }
.activity-popover [data-backend-activity-comment] { display: grid; gap: 3px; width: 100%; padding: 7px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: inherit; text-align: left; cursor: pointer; }
.activity-pulse { animation: activityPulse 1.5s ease-in-out infinite; }
@keyframes activityPulse { 50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent); } }
.task-activity.muted-activity { opacity: .72; }
.comment-tombstone { border-left: 3px solid var(--line); color: var(--muted); font-style: italic; }
.safe-user-text,.safe-user-link { overflow-wrap: anywhere; word-break: break-word; }
.safe-user-link { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.user-selector-card select { width: 100%; min-height: 42px; }
.management-selector select { width: 100%; min-height: 42px; }
.list-management-filters { display: grid; grid-template-columns: minmax(180px, 1fr) repeat(2, minmax(130px, .45fr)) auto; gap: 9px; align-items: end; }
.list-management-filters label { display: grid; gap: 4px; color: var(--muted); font-size: 12px; }
.list-management-filters input,.list-management-filters select { width: 100%; min-height: 40px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--text); }
.list-summary-results { display: grid; gap: 5px; max-height: 430px; overflow: auto; }
.list-summary-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 48px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: inherit; text-align: left; cursor: pointer; }
.list-summary-row > span:first-child { display: grid; gap: 3px; min-width: 0; }
.list-summary-row small { color: var(--muted); }
.list-summary-row.selected,.list-summary-row:hover,.list-summary-row:focus-visible { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--panel)); }
.list-selected-detail { min-width: 0; }
.error-state { color: var(--danger); }
@media (max-width: 760px) { .list-management-filters { grid-template-columns: 1fr; } }
.comment-edit-form textarea { width: 100%; min-height: 86px; resize: vertical; }
.comment-edit-form > .button { margin-top: 7px; }
.comment-pending { opacity: .72; border-left: 3px solid var(--accent); padding-left: 8px; }
.comment-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 7px; }
.comment-edit-history { margin-top: 7px; }
.comment-edit-history p { margin: 4px 0; font-size: 12px; }
.comment-deep-link-highlight { animation: commentHighlight 1.6s ease-out; }
@keyframes commentHighlight { from { box-shadow: 0 0 0 4px var(--accent); } to { box-shadow: none; } }
.permission-matrix { display: grid; width: 100%; border: 1px solid var(--line); border-radius: 7px; overflow-x: auto; overflow-y: hidden; }
.permission-matrix-header, .permission-matrix-row { display: grid; grid-template-columns: minmax(250px, 1fr) repeat(3, minmax(148px, 160px)); align-items: stretch; min-width: 694px; }
.permission-matrix-header { background: color-mix(in srgb, var(--panel) 78%, var(--line)); border-bottom: 1px solid var(--line); }
.permission-matrix-header > *, .permission-matrix-row > * { padding: 7px 9px; }
.permission-matrix-header > *:not(:first-child) { text-align: center; white-space: nowrap; }
.permission-matrix-row + .permission-matrix-row { border-top: 1px solid var(--line); }
.permission-matrix-row label { display: inline-flex; align-items: center; justify-content: flex-start; gap: 6px; min-width: 0; min-height: 44px; cursor: pointer; white-space: nowrap; }
.permission-matrix-row label + label, .permission-matrix-label + label { border-left: 1px solid var(--line); }
.permission-matrix-row input[type="radio"] { width: 20px !important; height: 20px !important; min-width: 20px; padding: 0; margin: 0; flex: 0 0 20px; accent-color: var(--accent); }
.permission-matrix-row input[type="radio"]:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; }
.permission-matrix-label { display: grid; align-content: center; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.permission-matrix-label small { color: var(--muted); font-weight: 400; }
.comment-autosave-status { display: block; margin-top: 5px; color: var(--muted); }
.comment-autosave-status.error { color: var(--danger); }
.assignment-watchers-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: start; }
.assignment-watchers-grid fieldset { min-width: 0; max-height: 280px; overflow: auto; }
.autocomplete-results { display: grid; position: relative; z-index: 30; max-height: 220px; overflow: auto; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); box-shadow: 0 6px 18px #0001; }
.autocomplete-results:empty { display: none; }
.autocomplete-option { min-height: 44px; padding: 9px 10px; border: 0; border-bottom: 1px solid var(--line); background: var(--panel); color: inherit; text-align: left; cursor: pointer; }
.autocomplete-option:hover,.autocomplete-option:focus-visible,.autocomplete-option[aria-selected="true"] { background: color-mix(in srgb, var(--accent) 12%, var(--panel)); outline: 0; }
.check-option { display: inline-flex !important; align-items: center; gap: 8px !important; width: fit-content; max-width: 100%; min-height: 44px; padding: 5px 7px; cursor: pointer; line-height: 1.35; }
.check-option input[type="checkbox"],.check-option input[type="radio"] { flex: 0 0 auto; width: 20px; height: 20px; margin: 0; }
.detail-grid fieldset > .check-option,.drawer fieldset > .check-option { display: flex !important; }
.admin-permission-row,.inheritance-toggle { display: inline-flex !important; flex-direction: row-reverse; justify-content: flex-end; align-items: center; gap: 8px; width: fit-content; max-width: 100%; min-height: 44px; }
.admin-permission-row input[type="checkbox"],.inheritance-toggle input[type="checkbox"] { flex: 0 0 auto; width: 20px; height: 20px; margin: 0; }
.ui-icon { width: 1.1em; height: 1.1em; display: inline-block; flex: 0 0 auto; vertical-align: -.17em; }
.button .ui-icon,.nav-button .ui-icon { margin-right: 5px; }
.sidebar-list-label { display: inline-flex; align-items: center; gap: 7px; min-width: 0; }
.list-marker { display: inline-flex; align-items: center; justify-content: center; width: 1.35em; flex: 0 0 auto; }
.list-color-blue .nav-button,.list-style-preview.list-color-blue { border-left: 4px solid #72a7dd; background: #1f5f8d55; }
.list-color-green .nav-button,.list-style-preview.list-color-green { border-left: 4px solid #74b98b; background: #27674955; }
.list-color-purple .nav-button,.list-style-preview.list-color-purple { border-left: 4px solid #b094d8; background: #6b46a155; }
.list-color-orange .nav-button,.list-style-preview.list-color-orange { border-left: 4px solid #f0a35e; background: #b4530955; }
.list-color-red .nav-button,.list-style-preview.list-color-red { border-left: 4px solid #ef8585; background: #b4231855; }
.personal-list-style { display: grid; gap: 9px; }
.marker-picker { display: grid; grid-template-columns: repeat(8, minmax(36px, 1fr)); gap: 5px; max-height: 230px; overflow: auto; }
.marker-choice { min-width: 36px; min-height: 44px; border: 1px solid var(--line); border-radius: 5px; background: var(--panel); }
.marker-choice[aria-selected="true"] { border: 2px solid var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--panel)); }
.list-style-preview { padding: 9px 11px; border-radius: 5px; background: var(--bg); }
.copy-preview { padding: 12px; border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 6px; background: var(--bg); }
.copy-preview.applied { background: color-mix(in srgb, var(--accent) 10%, var(--panel)); }
.copy-preview p { margin: 5px 0; }
.template-selection-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.template-apply-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.template-preview-row,.bulk-title-preview-row { padding: 7px 0; border-bottom: 1px solid var(--line); }
#workflow-dialog { width: min(560px, calc(100% - 32px)); background: var(--panel); color: var(--text); }
#workflow-dialog [data-workflow-dialog-fields] { display: grid; gap: 10px; }
#workflow-dialog [data-workflow-dialog-text] { white-space: pre-line; }
.user-summary-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; max-height: 320px; overflow: auto; }
.lifecycle-panel { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.backend-productivity-dashboard { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; padding: 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel); }
@media (prefers-reduced-motion: reduce) {
  .task-activity *, .backend-task-row { animation: none !important; transition: none !important; }
}
.reminder-alert button { pointer-events: auto; position: relative; z-index: 1; }
.backend-task-row.overdue-attention:not(.completed) { border-left: 4px solid var(--danger); background: color-mix(in srgb, var(--danger) 8%, var(--panel)); animation: overdueAttention 2.2s ease-in-out infinite; }
.task-overdue-badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 2px 7px; background: var(--danger); color: #fff; font-size: 11px; line-height: 1.35; }
@keyframes overdueAttention { 50% { box-shadow: inset 5px 0 0 color-mix(in srgb, var(--danger) 35%, transparent); } }

@media (max-width: 760px) {
  .attachment-card { align-items: flex-start; flex-direction: column; }
  .backend-task-row { grid-template-columns: 26px 26px minmax(0, 1fr) 34px 34px; }
  .backend-task-filter { width: 100%; }
  .backend-task-filter input { width: 100%; }
  .list-permission-grid { grid-template-columns: 1fr; }
  .assignment-watchers-grid { grid-template-columns: 1fr; }
  .permission-matrix { overflow: visible; border: 0; gap: 8px; }
  .permission-matrix-header { display: none; }
  .permission-matrix-row { grid-template-columns: 1fr; min-width: 0; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
  .permission-matrix-row + .permission-matrix-row { border-top: 1px solid var(--line); }
  .permission-matrix-row label { border-left: 0 !important; border-top: 1px solid var(--line); white-space: normal; }
}
.deferred-feature-note {
  border-inline-start: 4px solid #946200;
  background: #fff8df;
  color: #553b00;
  padding: .75rem 1rem;
  border-radius: .35rem;
}

.deferred-feature-note button[disabled] {
  cursor: not-allowed;
  opacity: .72;
}
