.activity-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  overflow: hidden;
}
.activity-header {
  padding: 16px 28px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.activity-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.activity-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}
.activity-header-actions {
  display: flex;
  gap: 8px;
}
.activity-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px 12px;
}
.activity-filter {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.activity-filter label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.activity-filter--wide {
  grid-column: span 2;
}
.activity-filter .input {
  width: 100%;
  font-size: 12px;
  padding: 6px 10px;
}
.activity-filter .input:disabled {
  opacity: .55;
  cursor: not-allowed;
}
.activity-user-picker {
  position: relative;
}
.activity-user-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 12px;
  padding: 6px 10px;
  text-align: left;
  cursor: pointer;
  background: var(--input-bg, var(--surface));
}
.activity-user-trigger-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}
.activity-user-trigger-caret {
  font-size: 10px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.activity-user-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--surface-elev, var(--surface));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 50;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 300px;
  overflow: hidden;
}
.activity-user-search {
  flex-shrink: 0;
}
.activity-user-list {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
  min-height: 0;
}
.activity-user-row {
  display: flex;
  flex-direction: column;
  gap: 1px;
  align-items: flex-start;
  width: 100%;
  padding: 6px 10px;
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm, 6px);
  text-align: left;
  font-size: 12px;
  cursor: pointer;
  color: var(--text);
  transition: background .1s;
}
.activity-user-row:hover { background: var(--chip-bg); }
.activity-user-row-label {
  font-weight: 500;
}
.activity-user-row-sub {
  font-size: 10px;
  color: var(--text-muted);
}
.activity-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 28px 24px;
}
.activity-state {
  padding: 24px 0;
  text-align: center;
  color: var(--text-secondary);
  font-size: 13px;
}
.activity-loading,
.activity-empty,
.activity-error {
  padding: 28px 0;
}
.activity-error { color: var(--danger); }
.activity-table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.activity-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  table-layout: fixed;
}
.activity-table thead th:nth-child(1) { width: 14%; }   
.activity-table thead th:nth-child(2) { width: 14%; }   
.activity-table thead th:nth-child(3) { width: 26%; }   
.activity-table thead th:nth-child(4) { width: 24%; }   
.activity-table thead th:nth-child(5) { width: 22%; }   
.activity-th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface2);
  padding: 0;
  box-sizing: border-box;
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.activity-th-inner {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  min-height: 32px;
}
.activity-row {
  transition: background .12s;
  border-bottom: 1px solid var(--border);
}
.activity-row:last-child { border-bottom: 0; }
.activity-row:nth-child(even) { background: var(--surface2); }
.activity-row:hover           { background: var(--chip-bg); }
.activity-cell {
  padding: 2px 4px;
  color: var(--text);
  vertical-align: middle;
  line-height: 1;
  /* table-layout: fixed по умолчанию обрезает переполнение; разрешаем длинному тексту мягко переноситься, чтобы узкая колонка не обрезала содержимое строки целиком. word-break ловит очень длинные неразрывные токены (URL, длинные ID). */
  word-break: break-word;
  overflow-wrap: break-word;
}
.activity-cell--date {
  width: 14%;
  font-size: 12px;
  color: var(--text-secondary);
  white-space: normal;
}
.activity-cell--user { width: 14%; }
.activity-user {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.activity-cell--loc { width: 26%; font-size: 12px; }
.activity-loc-proj  { color: var(--text);           font-weight: 600; }
.activity-loc-board { color: var(--text-secondary); }
.activity-loc-col   { color: var(--text-muted); }
.activity-loc-sep   { color: var(--text-muted); margin: 0 4px; opacity: .7; }
.activity-cell--task { width: 24%; }
.activity-task {
  display: inline;
  font-weight: 600;
  color: var(--text);
  /* Без nowrap и без многоточия — длинный заголовок задачи должен переноситься на несколько строк, а не прятаться за «…». Правила word-break ячейки переносят и очень длинные неразрывные токены (URL, ID). */
  word-break: break-word;
  overflow-wrap: break-word;
}
.activity-task:hover {
  color: var(--accent);
  text-decoration: underline;
}
.activity-task--deleted {
  color: var(--text-muted);
  text-decoration: line-through;
  cursor: pointer;
}
.activity-task--deleted:hover {
  color: var(--danger);
  text-decoration: line-through underline;
}
.activity-trash-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  border-radius: 10px;
  background: var(--danger-soft);
  color: var(--danger);
  vertical-align: middle;
  white-space: nowrap;
}
.activity-cell--act { width: 22%; }
.activity-act-line {
  display: flex;
  align-items: center;
  gap: 6px;
}
.activity-act-label {
  font-weight: 600;
  font-size: 12px;
  color: var(--text);
}
.activity-act-summary {
  margin-top: 3px;
  font-size: 11px;
  color: var(--text-secondary);
  word-break: break-word;
}
.evdiff-add {
  color: var(--success);
  background: var(--success-soft);
  font-weight: 500;
  padding: 0 2px;
  border-radius: 3px;
}
.evdiff-del {
  color: var(--danger);
  background: var(--danger-soft);
  font-weight: 500;
  text-decoration: line-through;
  text-decoration-thickness: 1px;
  text-decoration-color: rgba(255, 92, 92, .65);
  padding: 0 2px;
  border-radius: 3px;
}
.activity-muted {
  color: var(--text-muted);
  font-style: italic;
}
.activity-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 10px 14px;
  background: var(--surface2);
  border-top: 1px solid var(--border);
}
.activity-footer-size {
  display: flex;
  align-items: center;
  gap: 6px;
}
.activity-count {
  font-size: 11px;
  color: var(--text-muted);
}
@media (max-width: 900px) {
  .activity-cell--loc,
  .activity-table .activity-th:nth-child(3) { display: none; }
}
@media (max-width: 640px) {
  .activity-cell--user,
  .activity-table .activity-th:nth-child(2) { display: none; }
}
.activity-th--sortable {
  cursor: pointer;
  user-select: none;
  transition: background .12s, color .12s;
}
.activity-th--sortable:hover {
  background: var(--chip-hover);
  color: var(--text);
}
.activity-th--sortable.active {
  color: var(--accent);
}
.activity-sort-arrow {
  display: inline-block;
  margin-left: 6px;
  font-size: 9px;
  opacity: .85;
}
.activity-resize-overlay {
  position: absolute;
  width: 0;
  height: 0;
  pointer-events: none;
}
.activity-resize-bar {
  position: fixed;
  width: 8px;
  cursor: col-resize;
  background: transparent;
  pointer-events: auto;
  transition: background .12s;
  z-index: 30;
}
.activity-resize-bar::after {
  content: "";
  position: absolute;
  top: 0;
  left: 3px;
  width: 2px;
  height: 100%;
  background: var(--border);
  transition: background .12s;
}
#activity-view[hidden] ~ * .activity-resize-bar,
#activity-view[hidden] .activity-resize-bar {
  display: none;
}
.activity-resize-bar:hover,
.activity-resize-bar.dragging {
  background: var(--accent-soft);
}
.activity-resize-bar:hover::after,
.activity-resize-bar.dragging::after {
  background: var(--accent);
}
body.activity-col-resizing,
body.activity-col-resizing * {
  cursor: col-resize !important;
  user-select: none !important;
}
.activity-th-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
body:not(.theme-dark) .activity-view {
  --bg:             #f5f7fa;
  --surface:        #ffffff;
  --surface-elev:   #ffffff;
  --surface2:       #f9fafb;
  --surface3:       #f3f4f6;
  --text:           #0f172a;
  --text-secondary: #334155;
  --text-muted:     #64748b;
  --border:         #cbd5e1;
  --border-strong:  #94a3b8;
  --chip-bg:        #f1f5f9;
  --chip-hover:     #e2e8f0;
  --input-bg:       #ffffff;
  --accent-soft:    rgba(15, 108, 189, .12);
  --danger:         #dc2626;
  --danger-soft:    rgba(220, 38, 38, .12);
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .08);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .10), 0 1px 2px rgba(0, 0, 0, .06);
  --shadow:    0 4px 14px rgba(0, 0, 0, .10);
  color: var(--text);
  background: var(--bg);
}
body:not(.theme-dark) .activity-row:nth-child(even) {
  background: #f6f8fb;
}
body:not(.theme-dark) .activity-row:hover {
  background: #eef2f7;
}
